Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Copying of Multiple Files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Sikkandhar

New User


Joined: 03 Dec 2007
Posts: 58
Location: Bangalore

PostPosted: Thu Jan 03, 2013 1:50 pm    Post subject: Copying of Multiple Files
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

Moderator


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

PostPosted: Thu Jan 03, 2013 2:09 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Jan 03, 2013 2:20 pm    Post subject: Reply to: Copying of Multiple Files
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: 58
Location: Bangalore

PostPosted: Thu Jan 03, 2013 2:42 pm    Post subject:
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: 1712
Location: UK

PostPosted: Thu Jan 03, 2013 2:58 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Thu Jan 03, 2013 3:05 pm    Post subject: Reply to: Copying of Multiple Files
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: 1703
Location: Australia

PostPosted: Sat Jan 05, 2013 3:24 pm    Post subject:
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 User


Joined: 31 Dec 2009
Posts: 437
Location: London

PostPosted: Fri Jan 18, 2013 6:16 pm    Post subject: Re: Reply to: Copying of Multiple Files
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Jan 18, 2013 6:20 pm    Post subject: Reply to: Copying of Multiple Files
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Adding records from two files into on... shiitiizz SYNCSORT 4 Mon Sep 19, 2016 8:41 pm
No new posts Icetool or Joinkeys example to compar... ishant chauhan DFSORT/ICETOOL 21 Sat Aug 20, 2016 2:40 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us