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
 

 

Combining the contents of 2 identically stuctured files

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

New User


Joined: 27 Sep 2007
Posts: 3
Location: Toronto

PostPosted: Fri Nov 09, 2007 6:52 am    Post subject: Combining the contents of 2 identically stuctured files
Reply with quote

Hi There,

Just wondering how I could combine the contents of 2 identically stuctured files. Both files contain a header, details, and a trailer record. I want to include the details from both but only need one header and one trailer (it doesn't matter which). Also, each trailer contains two different record counts in PD that I would like to sum together and write to the trailer record.

Each file is FB 300 with the following being the layout of the trailer in a COBOL layout:

Code:
05  TRANSIT        PIC S9(5)  COMP-3.
05  ACCOUNT        PIC S9(7)  COMP-3.
05  REC-TYPE       PIC X.
05  NUM-ACCOUNTS   PIC S9(9)  COMP-3.
05  NUM-RECORDS    PIC S9(9)  COMP-3.


The num-accounts field and the num-records field are the two fields I need to sum together from each trailer.

Chris
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Nov 09, 2007 8:26 am    Post subject:
Reply with quote

ChrisK
Hi, and welcome to forums.

Can you show some sample records for i/p and o/p?
How do you identify header and trailer record and detail record?
After combining both the files, should the detail records be sorted?
Back to top
View user's profile Send private message
ChrisK

New User


Joined: 27 Sep 2007
Posts: 3
Location: Toronto

PostPosted: Fri Nov 09, 2007 10:01 am    Post subject:
Reply with quote

Thanks for the greeting.

Actually the header, details and trailer all have the same layout for the first few bytes. So all records begin with transit, account, and then record type (in the format I described above). The record type of the header is '0', the details are '2', and the trailer is '9'. And, yes, the records need to be sorted in ascending order by the first 8 bytes (transit, account, rec type).

Thanks,

Chris
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Fri Nov 09, 2007 12:39 pm    Post subject:
Reply with quote

Chris,

Try this -

Code:
//STEP@  EXEC PGM=ICETOOL                       
//TOOLMSG  DD SYSOUT=*                           
//DFSMSG DD SYSOUT=*                             
//IPFILES DD DSN=FILE1,DISP=....                 
//        DD DSN=FILE2,DISP=....                 
//OPFILE DD  DSN=...,DISP=(MOD,CATLG),.....     
//TOOLIN DD *                                   
  COPY FROM(IPFILES) TO(OPFILE) USING(HEAD)     
  SORT FROM(IPFILES) TO(OPFILE) USING(DETL)     
  SORT FROM(IPFILES) TO(OPFILE) USING(TRIL)     
/*
//HEADCNTL DD *                               
**** COPY HEADER TO OP FILE                   
  SORT FIELDS=COPY,STOPAFT=1                   
/*                                             
//*                                           
//DETLCNTL DD *                               
***** COPY DETAILED RECORDS WITH SORT OPER     
  SORT FIELDS=(1,3,PD,A,                       
               4,4,PD,A,                       
               8,1,CH,A)                       
  INCLUDE COND=(8,1,CH,EQ,C'2')               
/*                                             
//*                                           
//TRILCNTL DD *                       
*** TRAILER RECORD                   
  INCLUDE COND=(8,1,CH,EQ,C'9')       
  SORT FIELDS=(8,1,CH,A)             
  SUM FIELDS=(14,5,PD)               
/*                                   
Back to top
View user's profile Send private message
ChrisK

New User


Joined: 27 Sep 2007
Posts: 3
Location: Toronto

PostPosted: Fri Nov 09, 2007 8:18 pm    Post subject:
Reply with quote

Beautiful!!! Works like a charm.

Thank you very much for the help!
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Sat Nov 10, 2007 7:02 am    Post subject:
Reply with quote

You are welcome Chris!!!!!
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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 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


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