IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

PS File copying in bulk


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Fri Jan 11, 2008 8:24 pm
Reply with quote

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
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Jan 11, 2008 9:16 pm
Reply with quote

You can use a simple REXX program also to achieve this.

Regards,
ganesh
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jan 11, 2008 10:05 pm
Reply with quote

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
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Fri Jan 11, 2008 10:19 pm
Reply with quote

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
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Mon Jan 14, 2008 2:23 pm
Reply with quote

Thanks a lot Guys !!!! I will try them !
icon_biggrin.gif
--Parag
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Tue Jan 22, 2008 7:47 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Jan 22, 2008 7:50 pm
Reply with quote

Interesting, especially since COPY is not a standard TSO command.
Back to top
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Tue Jan 22, 2008 9:32 pm
Reply with quote

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
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Wed Jan 23, 2008 2:11 pm
Reply with quote

Ganesh,
Lots of thanks for your help ! icon_biggrin.gif
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
View user's profile Send private message
Ganesh.Deokar

New User


Joined: 30 Sep 2005
Posts: 26
Location: Buffalo,NY

PostPosted: Wed Jan 23, 2008 7:25 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top