ex: INPUT --> USERID.CHAM*.PS*
OUTPUT DATASET USERID.DATASET.REPORT should contains
TSCH050.CHAMP.PS1
TSCH050.CHAMP.PS2
TSCH050.CHAMP.PS3
TSCH050.CHAMPION2.PS
TSCH050.CHAMPION1.PS1
i have used to below code(not in batch mode) for listing multiple datasets and i am getting the expected result.
PDS ='USERID.DATASET.REPORT'
DATA = SYSDSN("'"PDS"'")
IF DATA = 'OK' THEN
DO
X = MSG('OFF')
"DELETE ('"PDS"')"
X = MSG('ON')
END
/* ALLOCATE DATASET */
"ALLOC DD(DDIN) DA('"PDS"')",
" NEW LRECL(80) RECFM(F B) DSORG(PS) REUSE",
"SPACE(2,1) TRA"
DS=STRIP("USERID.CHAM*.PS*")
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(&DS)"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN
DO
SAY DSVAR
QUEUE " "DSVAR
N = QUEUED()
"ALLOC F(OUT) DS('"PDS"') MOD REUSE"
"EXECIO" N "DISKW OUT(FINIS "
"FREE F(OUT)"
END
ELSE LEAVE
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
DATA = SYSDSN("'"PDS"'")
IF DATA = 'OK' THEN
DO
X = MSG('OFF')
"DELETE ('"PDS"')"
X = MSG('ON')
END
/* ALLOCATE DATASET */
"ALLOC DD(DDIN) DA('"PDS"')",
" NEW LRECL(80) RECFM(F B) DSORG(PS) REUSE",
"SPACE(2,1) TRA"
DS=STRIP("USERID.CHAM*.PS*")
"ISPEXEC LMDINIT LISTID(IDV) LEVEL(&DS)"
DO FOREVER
"ISPEXEC LMDLIST LISTID("IDV") OPTION(LIST) DATASET(DSVAR)"
IF RC = 0 THEN
DO
SAY DSVAR
QUEUE " "DSVAR
N = QUEUED()
"ALLOC F(OUT) DS('"PDS"') MOD REUSE"
"EXECIO" N "DISKW OUT(FINIS "
"FREE F(OUT)"
END
ELSE LEAVE
END
"ISPEXEC LMDLIST LISTID("IDV") OPTION(FREE)"
My output dataset contains:
USERID.DATASET.REPORT
~~~~~~~~~~~~~~~~~~~~~~
TSCH050.CHAMP.PS1
TSCH050.CHAMP.PS2
TSCH050.CHAMP.PS3
TSCH050.CHAMPION2.PS
TSCH050.CHAMPION1.PS1
But when i submit the rexx program using Batch mode(IKJEFT01) i am getting "Dataset USERID.DATASET.REPORT" in use
message. I didnt change any code from the above.
Since i am new to rexx pragram please tell me how to rectify the problem and give idea to list multiple datasets
using JCL(DSLIST...)/REXX program if possible.
Thank you,
Magesh.