LIST

LANSA Integrator

LIST

The LIST command returns a working list of absolute file names in a directory.

The working list to return the file names must be defined with a single field long enough to contain the absolute file name.

If no DIR keyword is provided and the current directory has not be changed using other commands, the default JSM instance directory will be searched. Sub-directories are not searched.

If no EXT keyword is provided all files in the directory will be searched by default.

 

 LIST ------------- DIR --------- directory path ---------------->

 

                >-- EXT --------- file extension ---------------->

 

                >-- SORT -------- *NONE ------------------------->

                                  *NAME

                                  *MODIFIED

 

                >-- REVERSE ----- *YES --------------------------|

                                  *NO

 

Keywords

DIR

Nominate a relative or absolute directory path to be searched. Sub-directories are not searched.

EXT

Only select files with a nominated file extension. The filtering match is not case sensitive and does not require a '.' prefix.

For example:

 

LIST EXT(CSV)

 

SORT

The optional sort keyword allows sorting on file name or modified date.

The default value is *NONE.

REVERSE

The optional reverse keyword allows the sorted order to be reversed.

The default value is *NO.

Examples

RDML

This will return a list of file names in the /csvdata directory that have a CSV extension.

 

DEF_LIST NAME(#WRKLIST) FIELDS(#PATH) TYPE(*WORKING)

 

USE BUILTIN(JSM_COMMAND) WITH_ARGS('LIST DIR(/CSVDATA) EXT(CSV) SERVICE_LIST(PATH)') TO_GET(#JSMSTS #JSMMSG #WRKLST)

 

or equivalently,

 

DEF_LIST NAME(#WRKLIST) FIELDS(#PATH) TYPE(*WORKING)

 

USE BUILTIN(JSM_COMMAND) WITH_ARGS('SET DIR(/CSVDATA)') TO_GET(#JSMSTS #JSMMSG)

USE BUILTIN(JSM_COMMAND) WITH_ARGS('LIST EXT(CSV) SERVICE_LIST(PATH)') TO_GET(#JSMSTS #JSMMSG #WRKLST)

 

RDMLX

Def_list name(#wrklist) fields(#path) type(*working)

 

use builtin(jsmx_command) with_args(#jsmhandle 'list dir(/csvdata) ext(csv)') to_get(#jsmsts #jsmmsg #wrklist)