View previous topic :: View next topic
|
Author |
Message |
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Hi ALL,
I have a PS file which contains names of 30 plan files. I need to copy these 30 plan files to other files whos names are listed in an another PS file with same order. All the files having their names in 2nd PS file are to be created.
Can this be done thru DFSORT/ICETOOL or anyother utility of JCL ?
PS File1
Code: |
FIRST.FILE
SECOND.FILE
.
.
THIRTYTH.FILE
|
PS File2
Code: |
FIRST.FILE.NEW
SECOND.FILE.NEW
.
.
THIRTYTH.FILE.NEW
|
--Parag |
|
Back to top |
|
|
Ganesh.Deokar
New User
Joined: 30 Sep 2005 Posts: 26 Location: Buffalo,NY
|
|
|
|
You can use a simple REXX program also to achieve this.
Regards,
ganesh |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I'm not sure if there's a better way or not, but you could use DFSORT to generate an ICETOOL job for the internal reader that would do it. The generated ICETOOL job would look like this:
Code: |
//COPYPS JOB ...
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN01) TO(OUT01)
COPY FROM(IN02) TO(OUT02)
...
COPY FROM(IN30) TO(OUT30)
/*
//IN01 DD DSN=FIRST.FILE,DISP=SHR
//IN02 DD DSN=SECOND.FILE,DISP=SHR
...
//IN30 DD DSN=THIRTYH.FILE,DISP=SHR
//OUT01 DD DSN=FIRST.FILE.NEW,DISP=(NEW,CATLG,DELETE),...
//OUT02 DD DSN=SECOND.FILE.NEW,DISP=(NEW,CATLG,DELETE),...
...
//OUT30 DD DSN=THIRTYH.FILE.NEW,DISP=(NEW,CATLG,DELETE),...
|
You could use DFSORT to generate the COPY operators and INxx DD statements from input file1. You could use DFSORT to generate the OUTxx DD statements from input file2. You could use DFSORT to construct the job from the pieces and submit it to the internal reader.
If you want me to show you how to do it, show me a model for the //OUT01 DD statement to create the first output data set. |
|
Back to top |
|
|
Ganesh.Deokar
New User
Joined: 30 Sep 2005 Posts: 26 Location: Buffalo,NY
|
|
|
|
If the requirement is not restricting to use only ICETOOL then this REXX code can be used.
Code: |
/*rexx*/
/*-------------------------------------------------------------------*/
/* This will copy the files listed in first PS file to the files */
/* listed in second PS file */
/* first file in first PS file is copied to first file in Second PS */
/* file and so on */
/*-------------------------------------------------------------------*/
"execio * diskr file1 (stem read1. finis"
"execio * diskr file2 (stem read2. finis"
do i = 1 to read1.0
indsn = word(read1.i,1)
outdsn= word(read2.i,1)
"copy '"indsn"' '"outdsn"'"
end
|
Regards,
Ganesh |
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Thanks a lot Guys !!!! I will try them !
--Parag |
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Hi Ganesh,
I had to modify your rexx code as follows. It works fine gives desired results.
But tell me how do I check the status of job while its running, the way we check in spool for JCLs.
Code: |
/*REXX*/
/*-------------------------------------------------------------------*/
/* THIS WILL COPY THE FILES LISTED IN FIRST PS FILE TO THE FILES */
/* LISTED IN SECOND PS FILE */
/* FIRST FILE IN FIRST PS FILE IS COPIED TO FIRST FILE IN SECOND PS */
/* FILE AND SO ON */
/*-------------------------------------------------------------------*/
"EXECIO * DISKR FILE1 (STEM READ1. FINIS"
"EXECIO * DISKR FILE2 (STEM READ2. FINIS"
DO I = 1 TO READ1.0
INDSN = WORD(READ1.I,1)
OUTDSN= WORD(READ2.I,1)
"COPY '"INDSN"' '"OUTDSN"'"
END
EXIT 0
|
--Parag |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Interesting, especially since COPY is not a standard TSO command. |
|
Back to top |
|
|
Ganesh.Deokar
New User
Joined: 30 Sep 2005 Posts: 26 Location: Buffalo,NY
|
|
|
|
Parag,
You can insert the SAY commands before and after "COPY" statement, which will display the output on screen if you are invoking in foreground. If you are executing this REXX it through JCL, then it will display the output of SAY commands in spool.
Code: |
/*REXX*/
/*-------------------------------------------------------------------*/
/* THIS WILL COPY THE FILES LISTED IN FIRST PS FILE TO THE FILES */
/* LISTED IN SECOND PS FILE */
/* FIRST FILE IN FIRST PS FILE IS COPIED TO FIRST FILE IN SECOND PS */
/* FILE AND SO ON */
/*-------------------------------------------------------------------*/
"EXECIO * DISKR FILE1 (STEM READ1. FINIS"
"EXECIO * DISKR FILE2 (STEM READ2. FINIS"
DO I = 1 TO READ1.0
INDSN = WORD(READ1.I,1)
OUTDSN= WORD(READ2.I,1)
SAY 'COPYING ' INDSN
"COPY '"INDSN"' '"OUTDSN"'"
SAY 'COPIED ' INDSN ' TO ' OUTDSN
END
EXIT 0 |
|
|
Back to top |
|
|
ParagChouguley
Active User
Joined: 03 Feb 2007 Posts: 175 Location: PUNE(INDIA)
|
|
|
|
Ganesh,
Lots of thanks for your help !
But as I'm new to REXX, may I please request you to give total code (JCL + REXX) and tell me how to execute that ! Also I want return code with proper message if possible in case of abend or error.
--Parag |
|
Back to top |
|
|
Ganesh.Deokar
New User
Joined: 30 Sep 2005 Posts: 26 Location: Buffalo,NY
|
|
|
|
Parag,
You can use IKJEFT01 to execute your REXX program in batch. specify the REXX exec member name in SYSTSIN.
Code: |
//STEP001 EXEC PGM=IKJEFT01
//SYSEXEC DD DISP=SHR,DSN=your.rexx.library
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
%member
/*
//FILE1 DD DSN=file1,DISP=SHR
//FILE2 DD DSN=file2,DISP=SHR
|
I am also not sure how to pass the return code from REXX program to the JCL. |
|
Back to top |
|
|
|