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
 

 

Sort 10 files & combing all trailer recs with 2 totals t

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

New User


Joined: 22 Mar 2012
Posts: 2
Location: South Africa

PostPosted: Fri Mar 23, 2012 1:32 pm    Post subject: Sort 10 files & combing all trailer recs with 2 totals t
Reply with quote

Hi There,
I have 10 input files with attributes (RECFM=FB, LRECL=750). Each file contains detail records and a trailer record identified by ‘TRL’ in the 6th column:
FILE 1
.00..ZAP00000000000000002407978
.00..ZAP00000000000000002407978
.00..TRL00000000000000000000000....|20120401|16:00:00|000000003|000000003|000000002|000000003|000100000
.
.
.
FILE 10
.00. ZAP00000000000000000004758
.00..ZAP00000000000000000007978
.00..ZAP00000000000000001234566
.00..TRL00000000000000000000000....|20120401|16:00:00|000000003|000000003|000000003|000000002|000100000

I need the detail records from all 10 files to be merged into 1 output file and sorted by the first 32 bytes. I also need all 10 trailer records to be combined into 1 trailer record with the sum total of Field-1 and Field-2.

Field 1 in trailer starts in column 75 and is 9 numerics long
Field 2 in trailer starts in column 85 and is 9 numerics long
The trailer record in 115 bytes in length

OUTPUT
.00. ZAP00000000000000000004758
.00..ZAP00000000000000000007978
.00..ZAP00000000000000001234566
.00..ZAP00000000000000002407978
.00..ZAP00000000000000002407978
.00..TRL00000000000000000000000....|20120401|16:00:00|000000003|000000003|000000005|000000005|000100000

Anyones help would be greatly appreciated.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Fri Mar 23, 2012 2:08 pm    Post subject: Reply to: Sort 10 files & combing all trailer recs with
Reply with quote

More than one way to skin an egg.

Do you programs regularly check the trailer totals against the detail amounts? Maybe you can get away without checking that, (I'm picky).

Concatenate them to SORTIN. OMIT the TRL appropriately. Search the forum for TRAILER processing, as the trailer can be easily generated.

EDIT: Have a look at this for instance.
Back to top
View user's profile Send private message
Nicole Mathias

New User


Joined: 22 Mar 2012
Posts: 2
Location: South Africa

PostPosted: Fri Mar 23, 2012 3:16 pm    Post subject:
Reply with quote

Thank you i will try it.

The second total cannot be derived from the detail records which is why i need to add every trailers totals together. The totals are not compared to detail amounts in later programs but is used to split processing.

I will try seperating the sorts as suggested and will let you know.

Thanks icon_smile.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Fri Mar 23, 2012 3:23 pm    Post subject: Reply to: Sort 10 files & combing all trailer recs with
Reply with quote

I didn't suggest any seperation :-)

Funny trailers you have. Not really a trailer, just a different data record which happens to be the last.

You realise that if your total-which-can't-be-calculated-from-elsewhere goes "pants" and no-one notices for a while, you'll have some fun catching-up to do?

Back to the task.

Since you need to sort the data anyway, take your concatenated 10 files, do the sort, do a SUM (either actual or logical) which produces a single trailer with the relevant fields summed.

There are some examples here. Just popped in, no time to search myself at the moment.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Mar 23, 2012 10:16 pm    Post subject:
Reply with quote

Use the following DFSORT JCL which will give you the desired results. I assumed that you don't have any duplicates on the data records on the first 32 bytes. If you do have duplicates then they would be eliminated. Let me know if you want to keep the duplicates on the data records.


Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD DSN=Your Input FB LRECL 750 byte file01,DISP=SHR
//         DD DSN=Your Input FB LRECL 750 byte file02,DISP=SHR
//         DD DSN=Your Input FB LRECL 750 byte file03,DISP=SHR
//         DD DSN=Your Input FB LRECL 750 byte file04,DISP=SHR
...
//         DD DSN=Your Input FB LRECL 750 byte file10,DISP=SHR
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(751:1,32,18C'0')),             
  IFTHEN=(WHEN=(6,3,CH,EQ,C'TRL'),OVERLAY=(751:32C'9',75,9,85,9))

  SORT FIELDS=(751,32,CH,A),EQUALS                               
  SUM FIELDS=(783,9,792,9),FORMAT=ZD                             
                                                                 
  OUTREC IFOUTLEN=750,                                           
  IFTHEN=(WHEN=(6,3,CH,EQ,C'TRL'),OVERLAY=(75:783,9,85:792,9))   
//*
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 Getting sum on Totals and Adjusted to... balaji81_k DB2 3 Fri Mar 24, 2017 7:51 pm
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 Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm


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