GETLIST

GETLIST allows the program to retrieve a previously stored list (perhaps created with the SAVE-LIST command), into a jBC variable.

COMMAND SYNTAX

    GETLIST expression TO variable1 { SETTING variable2 } THEN | ELSE statements

SYNTAX ELEMENTS

variable1 is the variable into which the list will be read. expression should evaluate to the name of a previously stored list to retrieve, or null. If expression evaluates to null, the current default external select list (generated by a previous SELECT command for example) will be retrieved. If specified, variable2 will be set to the number of elements in the list.

If the statement succeeds in retrieving the list, then the statements associated with any THEN clause will be executed. If the statement fails to find the list, then the statements associated with any ELSE clause will be executed.

NOTES

The GETLIST statement is identical in function to the READLIST statement. See also: DELETELIST, WRITELIST

EXAMPLE

       EXECUTE 'SELECT . SAMPLE 5' :@FM: 'SAVE-LIST FILES-LIST'
       GETLIST 'FILES-LIST' TO V.FILES.L ELSE
          CRT 'GETLIST error'
          STOP
       END
       LOOP
          REMOVE V.FILE FROM V.FILES.L SETTING V.STATUS
          CRT '[' : V.FILE : ']'
          IF V.STATUS EQ 0 THEN BREAK
       REPEAT

Output of this program looks like:

     5 record(s) saved to list 'FILES-LIST'
     [&COMO&]
     [&COMO&]D]
     [&ED&]
     [&ED&]D]
     [&PH&]

Last update: Sat, 16 Jul 2022 15:34