Suppose You have a List of PS Datasets with a naming Pattern. In Your Rexx Program You want to read the data of the concatenated list of Datasets the same way as You would do by giving a list of DD DSN= statements with the same DDName in a JCL. To Achieve this, You can use the LMDINIT and LMDLIST ISPEXEC services in Your Rexx Program.
The data set list service (LMDLIST) generates and uses an internal list of data set names associated with a unique data set list ID (dslist ID) obtained from the LMDINIT service.
The names in the internal list can be passed to a dialog with data set information (if specified) using two options:
The internal list is not dynamic. Data sets created after the invocation of the LMDINIT service will not added to the list. To update the list to include new data set names, use the LMDFREE service to release the current dslist ID and reissue the LMDINIT and LMDLIST services, or reissue the LMDINIT and LMDLIST services using a different dslist ID.
The example program is shown below.
/* REXX */
CONCLIST=""
ADDRESS ISPEXEC
/* N.B: DATASET NAME TEMPLATE NOT BOUNDED BY SINGLE QUOTES */
"LMDINIT LISTID(LISTID) LEVEL(AIW.AIWXR*.**.DATA*)"
DATASET=""
DO FOREVER
OK="4 8";"LMDLIST LISTID("LISTID") DATASET(DATASET)"
IF RC>0 THEN DO
LEAVE
END
CONCLIST=CONCLIST" '"STRIP(DATASET,"B")"'"
END
CONCLIST=SUBSTR(CONCLIST,2)
"LMDFREE LISTID("LISTID")"
ADDRESS TSO
/* N.B: DATASET NAMES NOW BOUNDED BY SINGLE QUOTES */
"ALLOC FI(TEMP) DA("CONCLIST") SHR REUSE"
"EXECIO * DISKR TEMP (OPEN STEM REC. FINIS)"
"FREE FI(TEMP)"
DO R=1 TO REC.0
SAY STRIP(REC.R,"T")
END
EXIT
SAY THE INPUT FILES ARE AS BELOW:
USER AIW.AIWXR1.DATE1.DATA
000001 DATA1 LINE 1
000002 DATA1 LINE 2
000003 DATA1 LINE 3
USER AIW.AIWXR5.DATE2.DATA
000001 DATA2 LINE 1
000002 DATA2 LINE 2
000003 DATA2 LINE 3
USER AIW.AIWXR4.DATE3.DATA
000001 DATA3 LINE 1
000002 DATA3 LINE 2
000003 DATA3 LINE 3
When running the Output we get:
DATA1 LINE 1
DATA1 LINE 2
DATA1 LINE 3
DATA2 LINE 1
DATA2 LINE 2
DATA2 LINE 3
DATA3 LINE 1
DATA3 LINE 2
DATA3 LINE 3
The data set list service (LMDLIST) generates and uses an internal list of data set names associated with a unique data set list ID (dslist ID) obtained from the LMDINIT service.
The names in the internal list can be passed to a dialog with data set information (if specified) using two options:
- The LIST option returns the information one name at a time through the function pool variables.
- The SAVE option writes the names and information to a data set.
The internal list is not dynamic. Data sets created after the invocation of the LMDINIT service will not added to the list. To update the list to include new data set names, use the LMDFREE service to release the current dslist ID and reissue the LMDINIT and LMDLIST services, or reissue the LMDINIT and LMDLIST services using a different dslist ID.
The example program is shown below.
/* REXX */
CONCLIST=""
ADDRESS ISPEXEC
/* N.B: DATASET NAME TEMPLATE NOT BOUNDED BY SINGLE QUOTES */
"LMDINIT LISTID(LISTID) LEVEL(AIW.AIWXR*.**.DATA*)"
DATASET=""
DO FOREVER
OK="4 8";"LMDLIST LISTID("LISTID") DATASET(DATASET)"
IF RC>0 THEN DO
LEAVE
END
CONCLIST=CONCLIST" '"STRIP(DATASET,"B")"'"
END
CONCLIST=SUBSTR(CONCLIST,2)
"LMDFREE LISTID("LISTID")"
ADDRESS TSO
/* N.B: DATASET NAMES NOW BOUNDED BY SINGLE QUOTES */
"ALLOC FI(TEMP) DA("CONCLIST") SHR REUSE"
"EXECIO * DISKR TEMP (OPEN STEM REC. FINIS)"
"FREE FI(TEMP)"
DO R=1 TO REC.0
SAY STRIP(REC.R,"T")
END
EXIT
SAY THE INPUT FILES ARE AS BELOW:
USER AIW.AIWXR1.DATE1.DATA
000001 DATA1 LINE 1
000002 DATA1 LINE 2
000003 DATA1 LINE 3
USER AIW.AIWXR5.DATE2.DATA
000001 DATA2 LINE 1
000002 DATA2 LINE 2
000003 DATA2 LINE 3
USER AIW.AIWXR4.DATE3.DATA
000001 DATA3 LINE 1
000002 DATA3 LINE 2
000003 DATA3 LINE 3
When running the Output we get:
DATA1 LINE 1
DATA1 LINE 2
DATA1 LINE 3
DATA2 LINE 1
DATA2 LINE 2
DATA2 LINE 3
DATA3 LINE 1
DATA3 LINE 2
DATA3 LINE 3
HI,
ReplyDeleteIs there any way to Concatenate/COPY all "A.B.*.C.D*" listed dataset into a output dataset (DASD).
else need to give all the DD in sortin to do the same :(.
Thanks in advance for any suggestion.
Source:
ReplyDeleteKurt Deininger / Sep 24, 2010 / http://ibmmainframes.com/about51372.html
...perhaps you have just forgotten ;o)