ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Sequencing IFS file name array

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sequencing IFS file name array

    Hello,

    I have an array that contains a list of files from a given IFS directory.
    The size of this array is say 1000.
    As the filename are not loaded in the array based on the sequence in which they were created in the IFS directory, I need to sort (ascending) the array based on the filename.
    However, when I do, I get all of the blank array elements first. Which means I need to check maybe 999 elements first.

    How do I sort and array in ascending sequence, but I'm only interested in sorting those elements that have a filename in it.

    file0010.txt
    file0005.txt
    file0015.txt

    should be sequenced to;
    file0005.txt
    file0010.txt
    file0015.txt

    thankyou.

  • #2
    Re: Sequencing IFS file name array

    Hi

    Try to use INZ on an array with *HIVAL,
    or use SORTA with %SUBARR(wArr:1:iNum) where iNum is number of elements in array
    Last edited by Zdenko; July 3, 2012, 04:46 AM. Reason: majhen popravek
    LP Zdenko

    Comment

    Working...
    X