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
 

 

Single OutPut file from multiple input files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Thu Aug 18, 2011 4:23 pm    Post subject: Single OutPut file from multiple input files
Reply with quote

I have 5 input files, say
INPUT.FILE1
INPUT.FILE2
INPUT.FILE3
INPUT.FILE4
INPUT.FILE5

each of LRECL=80

Now i want to create a single output file say MASTER.OUTPUT file which should contain records from each of the above five input files with an additional 9 bytes hard coded
value added at the end of each record resulting in LRECL=89 for MASTER.OUTPUT.

hard coded value will be different for each of the input files. that is,
for all the recordsin INPUT.FILE1 the 9 byte hardcoded value will be 111111111,
for all the recordsin INPUT.FILE2 the 9 byte hardcoded value will be 222222222,
for all the recordsin INPUT.FILE3 the 9 byte hardcoded value will be 333333333,
for all the recordsin INPUT.FILE4 the 9 byte hardcoded value will be 444444444,
for all the recordsin INPUT.FILE5 the 9 byte hardcoded value will be 555555555

So if each input files have 100 records, then my output file will have 500 records.

How do I get this done using DFSORT.

I have tried few things but unable to get what I want. Any help will be highly appreciated.
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 18, 2011 5:16 pm    Post subject:
Reply with quote

Code:

//STEP0200 EXEC PGM=ICETOOL             
//SYSOUT   DD SYSOUT=*                   
//SIN1     DD *                         
THIS IS FILE1                           
//SIN2     DD *                         
THIS IS FILE2                           
//SIN3     DD *                         
THIS IS FILE3                           
//SIN4     DD *                         
THIS IS FILE4                           
//SIN5     DD *                         
THIS IS FILE5                           
//SOUT     DD DISP=(MOD,CATLG),DSN=yourdatasetnamehere                   
//TOOLMSG  DD SYSOUT=*                   
//DFSMSG   DD SYSOUT=*                   
//TOOLIN   DD *                         
  COPY FROM(SIN1) TO(SOUT) USING(CTL1)   
  COPY FROM(SIN2) TO(SOUT) USING(CTL2)   
  COPY FROM(SIN3) TO(SOUT) USING(CTL3)   
  COPY FROM(SIN4) TO(SOUT) USING(CTL4)   
  COPY FROM(SIN5) TO(SOUT) USING(CTL5)   
/*                                     
//CTL1CNTL DD *                       
  INREC OVERLAY=(81:C'11111111')       
//CTL2CNTL DD *                       
  INREC OVERLAY=(81:C'22222222')       
//CTL3CNTL DD *                       
  INREC OVERLAY=(81:C'33333333')       
//CTL4CNTL DD *                       
  INREC OVERLAY=(81:C'44444444')       
//CTL5CNTL DD *                       
  INREC OVERLAY=(81:C'55555555')       
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Aug 18, 2011 10:09 pm    Post subject:
Reply with quote

Techslam,

Since all files are of same lrecl and recfm , it is easy to have delimiter and copy them easily into 1 big file. Use the following DFSORT JCL which will give you the desired results. I used $$ as delimiter , if your input has $$ in pos 1-2 , then change the delimiter to something else.

Code:

//STEP0100 EXEC PGM=SORT         
//SYSOUT   DD SYSOUT=*           
//SORTIN   DD *                 
$$                               
//         DD *                 
MY 1ST FILE RECORD - 1           
//         DD *                 
$$                               
//         DD *                 
MY 2ND FILE RECORD - 1           
MY 2ND FILE RECORD - 2           
//         DD *                 
$$                               
//         DD *                 
MY 3RD FILE RECORD - 1           
MY 3RD FILE RECORD - 2           
MY 3RD FILE RECORD - 3           
//         DD *                 
$$                               
//         DD *                 
MY 4TH FILE RECORD - 1           
MY 4TH FILE RECORD - 2           
MY 4TH FILE RECORD - 3           
MY 4TH FILE RECORD - 4           
//         DD *                 
$$                               
//         DD *                 
MY 5TH FILE RECORD - 1           
MY 5TH FILE RECORD - 2           
MY 5TH FILE RECORD - 3           
MY 5TH FILE RECORD - 4           
MY 5TH FILE RECORD - 5           
//SORTOUT  DD SYSOUT=*           
//SYSIN    DD *                                                   
  OPTION COPY                                                     
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),PUSH=(81:ID=1)),
  IFTHEN=(WHEN=(81,1,ZD,EQ,1),OVERLAY=(81:9C'1')),                 
  IFTHEN=(WHEN=(81,1,ZD,EQ,2),OVERLAY=(81:9C'2')),                 
  IFTHEN=(WHEN=(81,1,ZD,EQ,3),OVERLAY=(81:9C'3')),                 
  IFTHEN=(WHEN=(81,1,ZD,EQ,4),OVERLAY=(81:9C'4')),                 
  IFTHEN=(WHEN=(81,1,ZD,EQ,5),OVERLAY=(81:9C'5'))                 

  OUTFIL OMIT=(1,2,CH,EQ,C'$$')                                   
//*
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 18, 2011 10:26 pm    Post subject:
Reply with quote

Kolusu wrote:
I used $$ as delimiter
..

This was cool..
Back to top
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Fri Aug 19, 2011 1:15 pm    Post subject:
Reply with quote

Ok, My JCL looks like this as per my requirement :

My all five input files are of LRECL=1500, want to insert a 9 byte value at position 1175 and from 1184 till 1500 I want spaces.

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
$$                                                                     
//         DD DSN=INPUT.FILE1,DISP=SHR         
//         DD *                                                         
$$                                                                     
//         DD DSN=INPUT.FILE2,DISP=SHR             
//         DD *                                                         
$$                                                                     
//         DD DSN=INPUT.FILE3,DISP=SHR           
//SORTOUT  DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE)                                               
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),PUSH=(1500:ID=1)),   
  IFTHEN=(WHEN=(1500,1,ZD,EQ,1),OVERLAY=(1175:C'834728178',1184:317X)),
  IFTHEN=(WHEN=(1500,1,ZD,EQ,2),OVERLAY=(1175:C'441259166',1184:317X)),
  IFTHEN=(WHEN=(1500,1,ZD,EQ,3),OVERLAY=(1175:C'482424158',1184:317X)),
  OUTFIL OMIT=(1,2,CH,EQ,C'$$')                                         
//*                                                                     



When i submit this JCL i get the error as :
Code:

  OUTFIL OMIT=(1,2,CH,EQ,C'$$')           
  $                                       
INVALID INREC OR OUTREC STATEMENT OPERAND


When I removed the OUTFIL and then submited, I get a diference error as:
Code:

INVALID DATA SET ATTRIBUTES: SORTIN   LRECL   - REASON CODE IS 05


Where am I going wrong. Please guide me. Thanks
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 19, 2011 1:44 pm    Post subject:
Reply with quote

Hello,

Code:
INVALID INREC OR OUTREC STATEMENT OPERAND
INVALID DATA SET ATTRIBUTES: SORTIN   LRECL   - REASON CODE IS 05

Post the message id's for these.
Back to top
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Fri Aug 19, 2011 1:47 pm    Post subject:
Reply with quote

Hi, Please find the message ID below :
Code:
ICE104A 0 INVALID INREC OR OUTREC STATEMENT OPERAND 



Code:
ICE043A 3 INVALID DATA SET ATTRIBUTES: SORTIN   LRECL   - REASON CODE IS 05


thanks
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 19, 2011 1:52 pm    Post subject: Reply to: Single OutPut file from multiple input files
Reply with quote

Can you show the all the sort card data?

Have you missed off the last comma before OUTFIL?
Back to top
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Fri Aug 19, 2011 1:58 pm    Post subject:
Reply with quote

This is how my complete JCL looks :
Code:
//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
$$                                                                     
//         DD DSN=INPUT.FILE1,DISP=SHR         
//         DD *                                                         
$$                                                                     
//         DD DSN=INPUT.FILE2,DISP=SHR             
//         DD *                                                         
$$                                                                     
//         DD DSN=INPUT.FILE3,DISP=SHR           
//SORTOUT  DD DSN=OUTPUT.FILE,DISP=(NEW,CATLG,DELETE)                                               
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'$$'),PUSH=(1500:ID=1)),   
  IFTHEN=(WHEN=(1500,1,ZD,EQ,1),OVERLAY=(1175:C'834728178',1184:317X)),
  IFTHEN=(WHEN=(1500,1,ZD,EQ,2),OVERLAY=(1175:C'441259166',1184:317X)),
  IFTHEN=(WHEN=(1500,1,ZD,EQ,3),OVERLAY=(1175:C'482424158',1184:317X)),
  OUTFIL OMIT=(1,2,CH,EQ,C'$$')                                         
//* 
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 19, 2011 2:04 pm    Post subject: Reply to: Single OutPut file from multiple input files
Reply with quote

I was looking at your cards, which I thought someone else provided!

Remove the last comma before the OUTFIL....
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Fri Aug 19, 2011 2:10 pm    Post subject: Reply to: Single OutPut file from multiple input files
Reply with quote

For your second problem, your input files magically changed from fixed 80 to fixed non-80.

Then, you try to concatenate non-80s and 80s (the DD *): you can't do that, so you get the error.

I suppose one way would be to generate the delimiter as a 1500 (or whatever it is as the time) fixed records, and then include it in the concatenated DD five times instead of doing it with the DD *.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Aug 19, 2011 10:03 pm    Post subject:
Reply with quote

techslam wrote:
My all five input files are of LRECL=1500, want to insert a 9 byte value at position 1175 and from 1184 till 1500 I want spaces.


techslam,

Is it really that difficult to provide that vital piece of information in your first post itself? Now a day later will you say your input files are VB? You are just wasting my time as well as your time. Bill already explained the 2 problems you have with your JCL.
Back to top
View user's profile Send private message
techslam

New User


Joined: 03 Dec 2010
Posts: 87
Location: India

PostPosted: Fri Aug 19, 2011 11:59 pm    Post subject:
Reply with quote

@Skolusu

I apologise for not providing complete requirement. I actually wanted to give a similar scenario and try rest by my own from the code that you provided. It was of much helpful. Thanks a lot. Yes, I created a dummy delimetr file of LRECL=1500 with $$ in first two bytes positiopn and rest of your code just worked perfectly. Thanks everyone and ZSkolusu especially for taking time to solve this for me. I really appreciate the help
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 -> DFSORT/ICETOOL 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 Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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