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
 

 

Sum of the trailer totals of different files into 1 file

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

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Wed Oct 17, 2007 12:13 pm    Post subject: Sum of the trailer totals of different files into 1 file
Reply with quote

Hi All,

Would you please suggest any solution for the below requirement.

Our requirement is like, we have 5 files with 100 (assuming) detail records and 1 trailer record in each file. Now our requirement is to merge all these five files in to a single file with 500 (assuming) detail records and one single trailer record at the end.

Our problem is, trailer of the each file contains total number of detail records (at 10:12 position) and total amount of all detail records (at 22:12 position). Like wise we have different totals on all the five files trailers.

Now our intention is to get one single trailer with the sum of values (ie. total number of records and total amount) in the individual files trailers after merging in to a single file.

More details on the file attriburtes: Fixed length file with record length 100 bytes.

Please provide the solution.

Many thanks in advance,
Kranti and Sarma.
Back to top
View user's profile Send private message

nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Wed Oct 17, 2007 12:17 pm    Post subject:
Reply with quote

HI Kranti,
please clarify what is the difference between total number of detail records (at 10:12 position) and total amount of all detail records (at 22:12 position) in a single trailer.
Back to top
View user's profile Send private message
murmohk1

Senior Member


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

PostPosted: Wed Oct 17, 2007 12:17 pm    Post subject:
Reply with quote

Kranti,

Quote:
Like wise we have different totals on all the five files trailers.

If the record count vary from file to file, what is the condition for combining records.

Need sample I/P and O/P data. You should provide all different scenarios you can think.
Back to top
View user's profile Send private message
kranti

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Wed Oct 17, 2007 5:38 pm    Post subject:
Reply with quote

Hi Murali,

Let's take
File1 trailer has 000000100000 (12 bytes) at 10 th position which is a number of detail records of that particular file generated by program AAA.

File1 trailer has 000000500000 (22 bytes) at 22nd position which is a total amount of detail records of that particular file generated by program AAA.

Program AAA has run 5 times with different input data and created 5 different files with different number of totals in their trailers like File1 File2 File3 File4 File4.

Our requirement is to merge all the 5 output files produced by the 5 runs.

After the merge the final file should contain the detail records of all the 5 output files and also one trailer record in the end with the sum of totals
of numbers and amounts in the 12th (12 bytes) and 22nd (12bytes) positions respectively.

As you asked, there is no condition to add the totals and whatever the amounts are present in the specified location above must be summed up and need to be extracted in to the final file.

Please let me if more details are needed..


Thanks,
Kranti
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Wed Oct 17, 2007 5:51 pm    Post subject:
Reply with quote

kranti
You havent ansewerd murli question completely.
Quote:
Need sample I/P and O/P data. You should provide all different scenarios you can think.

I will elaborate the Question:
1. How do you identify the detail and trailer record.
2. In what format is the count and amount available(PD,ZD..?)
Back to top
View user's profile Send private message
kranti

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Wed Oct 17, 2007 7:46 pm    Post subject:
Reply with quote

Hi

Sorry for that..

Detail records will have the first byte as 'D' and the trailer record has 'T' as the first byte.

Counts are of of numeric 9(12) (ZD)

And the all the 5 files will have the below record layout format.

01 :POGL:-DATA-RECORD. ------> DETAIL RECORD LAYOUT
03 :POGL:-D-REC-IND PIC X. ----> It is D
03 :POGL:-AGRMT-NO PIC X(10).
03 :POGL:-TRN-CODE PIC X(3).
03 :POGL:-EFFT-DATE PIC 9(8).
03 :POGL:-PROC-DATE PIC 9(8).
03 :POGL:-ENTRY-ID PIC X(15).
03 :POGL:-AMOUNT PIC 9(12).
03 :POGL:-LOGO PIC X(3).
01 :POGL:-TRAILER-RECORD. -----TRAILER RECORD LAYOUT
03 :POGL:-T-REC-IND PIC X. --- It is T
03 :POGL:-DATE-FCRET PIC 9(8).
03 :POGL:-TOT-NUM-RECS PIC 9(12).
03 :POGL:-TOT-TRAN-AMT PIC 9(12).
03 FILLER PIC X(27).

Each file consists of one trailer at the end of all the detail records which is the last record in the file.

Does the above information is sufficient to address the problem? Please let me know..

Thanks,
Kranti
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Oct 17, 2007 10:25 pm    Post subject:
Reply with quote

Quote:
03 :POGL:-DATE-FCRET PIC 9(8).


Do you need to keep this date field from one of the trailer records? If so, which one?

Or is this some form of the current system date? If so, what form?

Quote:
03 FILLER PIC X(27).


Are these blanks? If not, what are they?
Back to top
View user's profile Send private message
kranti

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Thu Oct 18, 2007 7:12 pm    Post subject: Reply to: Sum of the trailer totals of different files into
Reply with quote

Hi Frank,

This field is the todays date and it is of DDMMYY format. All the 5 files have the same date, so if it can be extracted from any file is ok.


Thanks,
Kranti
Back to top
View user's profile Send private message
kranti

New User


Joined: 10 Oct 2005
Posts: 27

PostPosted: Thu Oct 18, 2007 7:13 pm    Post subject: Reply to: Sum of the trailer totals of different files into
Reply with quote

Further to my previous post,

Yes...x(27) field consists of blanks...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Oct 18, 2007 9:14 pm    Post subject:
Reply with quote

Quote:
03 :POGL:-DATE-FCRET PIC 9(8).


Quote:
This field is the todays date and it is of DDMMYY format.


DDMMYY is only 6 bytes but the field is 8 bytes, so I'll assume it's really DDMMYYYY. If not, use DATENS=(DMY) instead of DATENS=(DM4) in TRAILER1.

Here's a DFSORT job that will do what you asked for:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file1
//       DD DSN=...  input file2
//       DD DSN=...  input file3
//       DD DSN=...  input file4
//       DD DSN=...  input file5
//       DD DSN=&&I3,DISP=(OLD,PASS)
//       DD DSN=&&I4,DISP=(OLD,PASS)
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(1,1,CH,EQ,C'T')
  OUTFIL REMOVECC,
    TRAILER1=('T',
      DATENS=(DM4),
      10:COUNT=(M11,LENGTH=12),
      22:TOT=(46,12,ZD,M11,LENGTH=12),
      27X)
/*
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm


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