Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
I would write a program that does dynamic allocation of input and output data sets, taking in a list of input and output DSNs. Other sempai may offer other solutions; in particular, a *Sort maven as such Mr. Woodger may have a *Sort solution.
I tried few codes it doesn't work well but I got to know that if it is in REXX we can do . I don't have any idea about REXX .If anyone find an answer(even if it is in REXX also) please post it here
The query raised is a little vague, also we donot know what all you've already tried that 'did not work'.
A few quick questions that come to mind on reading the post:
a. Are all the 'N' VB datasets having same RECL, or are they different?
b. Will the programmer 'be aware' of the input LRECL or they can vary depending upon every run?
c. How does the programmer choose the output LRECL for any of the input?
Either way, if you choose DFSORT to do this, a quick solution with a bit of coding, can be rigged up as below (this is but one of many ways):
1. Have the list of input VB DS in a PS dataset
2. Use this DS as input and generate a dynamic JCL which uses OUTFIL VTOF function of *SORT; again this can be done by using multiple SORT steps or a single ICETOOL 'COPY FROM(IN) TO(OUT) USING(CTL)' step wherein, data in 'CTL' will remain constant, 'COPY FROM' statements will depend on how many datasets are to be copied.
3. Route the above output to INTRDR.
4. In case LRECL for the VB DS can vary, save the LISTDS info of all the datasets in a PS dataset; trim this data to group DSN and LRECL.
5. Use the aforementioned DFSORT JCL build to build the requisite COPY JCL using the info obtained in point '4'; and route the output to INTRDR.
A similar logic can be used in case of REXX; but there again, YOU will have to devise a solution to handle output LRECL.
DD01 DSN=$USER.INPUT1 OPENED AS PS,
RECFM=VB,LRECL=300,BLKSIZE=27968,VOL=STGA88
DD01O DSN=SYS16224.T172619.RA000.#123456.R0188163 OPENED AS PS,
RECFM=FB,LRECL=80,BLKSIZE=80,VOL=WRKT0M
$$DD01 COPY
ABOVE FUNCTION ENDED ON NORMAL EOD RC=0
RECORDS-READ=15,COPIED=15
15 RECORDS WRITTEN TO DD01O-SYS16224.T172619.RA000.#1233456.R0188163
VOL=WRKT0M
DD02 DSN=$USER.INPUT2 OPENED AS PS,
RECFM=VB,LRECL=300,BLKSIZE=27968,VOL=STGA88
DD02O DSN=SYS16224.T172619.RA000.#123456.R0188164 OPENED AS PS,
RECFM=FB,LRECL=80,BLKSIZE=80,VOL=WRKT0M
$$DD02 COPY
ABOVE FUNCTION ENDED ON NORMAL EOD RC=0
RECORDS-READ=15,COPIED=15
15 RECORDS WRITTEN TO DD01O-SYS16224.T172619.RA000.#1233456.R0188164
VOL=WRKT0M
DD03 DSN=$USER.INPUT3 OPENED AS PS,
RECFM=VB,LRECL=300,BLKSIZE=27968,VOL=STGA88
DD03O DSN=SYS16224.T172619.RA000.#123456.R0188165 OPENED AS PS,
RECFM=FB,LRECL=80,BLKSIZE=80,VOL=WRKT0M
$$DD03 COPY
ABOVE FUNCTION ENDED ON NORMAL EOD RC=0
RECORDS-READ=15,COPIED=15
15 RECORDS WRITTEN TO DD01O-SYS16224.T172619.RA000.#1233456.R0188165
VOL=WRKT0M