|
View previous topic :: View next topic
|
| Author |
Message |
Viswanath Reddy
New User
Joined: 08 Aug 2016 Posts: 2 Location: INDIA
|
|
|
|
Hi Everyone,
I am trying to convert N no.of files from VB to FB in single step but I am not finding right answer. Is any suggestions on this question
Thanks & Regards,
Viswanath Reddy Y |
|
| Back to top |
|
 |
Akatsukami
Global Moderator

Joined: 03 Oct 2009 Posts: 1787 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. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
| JCL does not have any looping / go to structures. Program is the best choice also look INTRDR to trigger multiple jobs for each file. |
|
| Back to top |
|
 |
Viswanath Reddy
New User
Joined: 08 Aug 2016 Posts: 2 Location: INDIA
|
|
|
|
| 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 |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
| you already have two solutions given so what is that you don't understand? what have you tried ? what doesn't work? |
|
| Back to top |
|
 |
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
Hello Viswanath,
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. |
|
| Back to top |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2276 Location: USA
|
|
|
|
FILEAID can do the job
| Code: |
//FILECOPY EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//*
//* INPUT DATA FILES
//DD01 DD DISP=SHR,DSN=&SYSUID..INPUT1
//DD02 DD DISP=SHR,DSN=&SYSUID..INPUT2
//DD03 DD DISP=SHR,DSN=&SYSUID..INPUT3
//* OUTPUT DATA FILES
//DD01O DD DISP=(NEW,PASS),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
// DSN=&&OUTFILE1
//DD02O DD DISP=(NEW,PASS),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
// DSN=&&OUTFILE2
//DD03O DD DISP=(NEW,PASS),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0),
// DSN=&&OUTFILE3
//*
//SYSIN DD *
$$DD01 COPY
$$DD02 COPY
$$DD03 COPY
//*
|
Confirmation of results: RECFM=VB --> RECFM=FB
| Code: |
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
|
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|