View previous topic :: View next topic
|
Author |
Message |
kranti
New User
Joined: 10 Oct 2005 Posts: 27
|
|
|
|
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 |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
kranti
New User
Joined: 10 Oct 2005 Posts: 27
|
|
|
|
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 |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
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 |
|
|
kranti
New User
Joined: 10 Oct 2005 Posts: 27
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
kranti
New User
Joined: 10 Oct 2005 Posts: 27
|
|
|
|
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 |
|
|
kranti
New User
Joined: 10 Oct 2005 Posts: 27
|
|
|
|
Further to my previous post,
Yes...x(27) field consists of blanks... |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|