Tuesday, July 21, 2009

Listing datasets - ISPF command

Initialises the list of datasets for a criterion:
"ISPEXEC LMDINIT LISTID(IDVAR) LEVEL("LEVELVAR")"
Where IDVAR is a variable to be used by the system to assign a name to the list initialised. LEVELVAR is a variable which holds the selection criteria. Ex: NFSK00.ABC*.KQLFR
Retrieve the list initialised:
"ISPEXEC LMDLIST LISTID("IDVAR") OPTION(LIST) DATASET(DSVAR)"
Where DSVAR is a variable which holds the current dataset in the list
After retrieving the ID variable IDVAR has to be freed:
"ISPEXEC LMDLIST LISTID("IDVAR") OPTION(FREE)"

If the ID variable is used so many times, say in a loop, it is advisable to initialise the variables IDVAR and DSVAR.
DROP IDVAR
DROP DSVAR

No comments: