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

Copying of Multiple Files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Thu Jan 03, 2013 1:50 pm
Reply with quote

Hi,

I have 2 files
- File F1 would contain file-names which has to be copied
- File F2 would contain the file name into which it has to be copied to

Assume F1 would contain
A.B.C.DT1210
A.B.C.DT1211
A.B.C.DT1212

Assume F2 would contain
A.B.C.DT1210.TEST
A.B.C.DT1211.TEST
A.B.C.DT1212.TEST

I want to copy the contents of
A.B.C.DT1210 --> A.B.C.DT1210.TEST
A.B.C.DT1211 --> A.B.C.DT1211.TEST
A.B.C.DT1212 --> A.B.C.DT1212.TEST

The number of Input file mentioned in File F1 is unknown.
Can this be done thru a Sort

Thanks
Sikkandhar
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Thu Jan 03, 2013 2:09 pm
Reply with quote

IIGC You can't do it directly just using sort probably you might need some help of REXX or any other programming language to generate the steps

Also is F1 = F2? In the sense does the number of records and sequence match ?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Jan 03, 2013 2:20 pm
Reply with quote

Quote:
Can this be done thru a Sort ?


NOT in one JOB

YES in TWO jobs
using <SORT> to build the jcl stream
and submitting it thru the internal reader

if You do not like YES/NO answers do not ask YES/NO questions
Back to top
View user's profile Send private message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 61
Location: Bangalore

PostPosted: Thu Jan 03, 2013 2:42 pm
Reply with quote

Hi Enrico,

Could you please tell me how the JCL stream can be created using SORT?
It's fine if it can be done in 2 Jobs

Thanks
Sikkandhar
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Thu Jan 03, 2013 2:58 pm
Reply with quote

Sikkander - you have been a member of the forum for 5 years and you do not know how to use the search function? Also, if you had been utilising the forum to maximum benefit you would have been 'popping in' weekly, preferably more often, to see hwat is going on and to pick up tips and you would have seen this sort of thing quite a few times. Then you would not have needed to post - just look for the relevant threads.

Why should someone sppon-feed you?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Thu Jan 03, 2013 3:05 pm
Reply with quote

there is just a small problem with Your approach
how are You going to allocate the <new> datasets

if You are willing to compromise on the output dataset name a better approach would be a dfdss


Code:
//DFDSS   EXEC PGM=ADRDSSU,PARM=('TYPRUN=NORUN')   
//...
//...
//...
//SYSIN     DD *
  COPY -
       DATASET( INCLUDE  ( -
                           A.B.C.DT1210 -
                           A.B.C.DT1211 -
                           A.B.C.DT1212 -
                ) ) -
  TOL(ENQF)   -
  REPUNC  -
  CATALOG    -
  ALLEXCP    -
  ALLDATA(*) -
  TGTALLOC(SOURCE)  -
  OPTIMIZE(4)  -
  RENAMEUNCONDITIONAL((A.** ATEST.**) )
/*
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Sat Jan 05, 2013 3:24 pm
Reply with quote

Hi,

try this

Code:
//S1       EXEC PGM=SYNCTOOL                                     
//IN1      DD *                                                 
A.B.C.DT1210                                                     
A.B.C.DT1211                                                     
A.B.C.DT1212                                                     
A.B.C                                                           
A.B                                                             
//IN2      DD *                                                 
A.B.C.DT1210.TEST                                               
A.B.C.DT1211.TEST                                               
A.B.C.DT1212.TEST                                               
A.B.C.TEST                                                       
A.B.TEST                                                         
//IN1O     DD DSN=&&IN1O,DISP=(,PASS,DELETE),UNIT=SYSDA,         
//            SPACE=(TRK,(10,5),RLSE)                           
//IN2O     DD DSN=&&IN2O,DISP=(,PASS,DELETE),UNIT=SYSDA,         
//            SPACE=(TRK,(10,5),RLSE)                           
//TOOLMSG  DD SYSOUT=*                                           
//DFSMSG   DD SYSOUT=*                                           
//TOOLIN   DD *                                                 
  COPY FROM(IN1) TO(IN1O) USING(CTL1)                     
  COPY FROM(IN2) TO(IN2O) USING(CTL2)                     
/*                                                       
//CTL1CNTL DD *                                           
   INREC OVERLAY=(45:SEQNUM,4,ZD)                         
/*                                                       
//CTL2CNTL DD *                                           
   INREC OVERLAY=(45:C',',46:SEQNUM,4,ZD,                 
        50:46,4,ZD,MOD,+255,M11,LENGTH=3)                 
   OUTREC BUILD=(1,45,SQZ=(SHIFT=LEFT),46,35)             
/*                                                       
//S2       EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTJNF1 DD DSN=&&IN1O,DISP=(OLD,DELETE)               
//SORTJNF2 DD DSN=&&IN2O,DISP=(OLD,DELETE)               
//SORTOUT  DD SYSOUT=*                                   
//SYSIN DD *                                             
  JOINKEYS FILE=F1,FIELDS=(45,4,A),SORTED                 
  JOINKEYS FILE=F2,FIELDS=(46,4,A),SORTED                 
  JOIN UNPAIRED                                           
  REFORMAT FIELDS=(F1:1,44,F2:1,53)                       
  OPTION COPY                                               
  OUTFIL REMOVECC,                                           
  IFTHEN=(WHEN=(94,3,ZD,EQ,+1),                             
    BUILD=(C'//JOB',SEQNUM,5,ZD,C' JOB GERRY,''COPY  '',',/,
           C'//             CLASS=A,         ',/,           
           C'//             MSGCLASS=X,      ',/,           
           C'//             NOTIFY=&SYSUID,  ',/,           
           C'//             COND=(0,LT)      ',/,           
           C'//*                             ',/,           
           C'//STEP',90,4,C' EXEC PGM=SORT',/,               
           C'//SYSOUT   DD SYSOUT=*          ',/,           
           C'//SYSIN    DD *                 ',/,           
           C'  SORT FIELDS=COPY              ',/,           
           C'//SORTIN   DD DISP=SHR,',/,                     
           C'//            DSN=',1,44,/,                     
           C'//SORTOUT  DD DSN=',45,45,/,                   
           C'//            DISP=(,CATLG,DELETE),',/,         
           C'//            LIKE=',1,44,/,                   
           C'//*',80:X)),                                   
  IFTHEN=(WHEN=(94,3,ZD,NE,+1),                             
    BUILD=(C'//STEP',90,4,C' EXEC PGM=SORT',/,               
           C'//SYSOUT   DD SYSOUT=*          ',/,               
           C'//SYSIN    DD *                 ',/,               
           C'  SORT FIELDS=COPY              ',/,               
           C'//SORTIN   DD DISP=SHR,',/,                       
           C'//            DSN=',1,44,/,                       
           C'//SORTOUT  DD DSN=',45,45,/,                       
           C'//            DISP=(,CATLG,DELETE),',/,           
           C'//            LIKE=',1,44,/,                       
           C'//*',80:X))                                       
/*                                                             


The assumption is that the files are PS and are on disk as I have used the LIKE parameter.

A job with a maximum of 255 steps will be generated, if more than 255 a new job will be generated.


Gerry
Back to top
View user's profile Send private message
Pete Wilson

Active Member


Joined: 31 Dec 2009
Posts: 580
Location: London

PostPosted: Fri Jan 18, 2013 6:16 pm
Reply with quote

enrico-sorichetti wrote:
there is just a small problem with Your approach
how are You going to allocate the <new> datasets

if You are willing to compromise on the output dataset name a better approach would be a dfdss


Code:
//DFDSS   EXEC PGM=ADRDSSU,PARM=('TYPRUN=NORUN')   
//...
//...
//...
//SYSIN     DD *
  COPY -
       DATASET( INCLUDE  ( -
                           A.B.C.DT1210 -
                           A.B.C.DT1211 -
                           A.B.C.DT1212 -
                ) ) -
  TOL(ENQF)   -
  REPUNC  -
  CATALOG    -
  ALLEXCP    -
  ALLDATA(*) -
  TGTALLOC(SOURCE)  -
  OPTIMIZE(4)  -
  RENAMEUNCONDITIONAL((A.** ATEST.**) )
/*


That wouldn't work as he's adding a qualifier in which case you have to specify the full source and target names with DFDSS. A right pain in the proverbial.

e.g.

RENAMEU( -
(A.B.C.DT1210 A.B.C.DT1210.TEST) -
(A.B.C.DT1211 A.B.C.DT1211.TEST) -
(A.B.C.DT1212 A.B.C.DT1212.TEST) -
)

If it was just the high level qualifier or one other single qualifier it's simple.

e.g
for HLQ

RENAMEU(newhlq)

For 2lQ
RENAMEU(A.B.C.DT%%%% A.X.C.D%%%%)
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Fri Jan 18, 2013 6:20 pm
Reply with quote

Quote:
That wouldn't work as he's adding a qualifier in which case you have to specify the full source and target names with DFDSS. A right pain in the proverbial.

I know that icon_cool.gif
but I also said ...
Quote:
if You are willing to compromise on the output dataset name
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Multiple table unload using INZUTILB DB2 2
Search our Forums:

Back to Top