vvgoud
New User
Joined: 16 Aug 2007 Posts: 27 Location: Hyderabad
|
|
|
|
Input File:
Code: |
HDRXXXXXXXX
ABTESTNAME000020000
ABTESTNAME000020000
ABTESTNAME000020000
BCTESTNAME000020000
BCTESTNAME000020000
BCTESTNAME000020000
BCTESTNAME000020000
CDTESTNAME000020000
CDTESTNAME000020000
CDTESTNAME000020000
T1AB0000000000000000000BC0000000000000000000CD0000000000000000000 TL00000000000000000000000000 |
Output need individual detail record count and amounts total also need grand total record count and Grand total amount in the Trailer record.
Input file detailed records are ‘AB’,’BC’,’CD’ and their respective deta
ils record counts are 3,4,3 and their Amount positions 11 to 19 total (length=7) ,
‘AB’ records total Amount = 60000 (20000+10000+30000),
‘BC’ records total Amount = 80000 (10000+20000+40000+10000),
‘CD’ records total Amount = 90000 (20000+10000+60000) and
Grand total record count (3 + 4 +3) and Grand total amount 230000(60000+80000+90000).
Trailer Record Format
Code: |
01 TLR-REC
05 FILLER PIC X(12).
05 T1-CODE PIC X(2) VALUE ‘T1’.
05 T1-DATA OCCURS 15 TIMES.
10 T1-INFO.
15 T1-CODE PIC X(2).
15 T1-COUNT PIC X(7) VALUE ZEROES.
15 T1-AMT PIC X(12) VALUE ZEROES.
05 TL-CODE PIC X(2) VALUE ‘TL’.
05 TL-GRAND-COUNT PIC X(12) VALUE ZEROES.
05 TL-GRAND-AMOUNT PIC X(14) VALUE ZEROES.
05 FILLER PIC X(263). |
Expected Output:
Code: |
HDRXXXXXXXX
ABTESTNAME000020000
ABTESTNAME000010000
ABTESTNAME000030000
BCTESTNAME000010000
BCTESTNAME000020000
BCTESTNAME000040000
BCTESTNAME000010000
CDTESTNAME000020000
CDTESTNAME000010000
CDTESTNAME000060000
TLRAB0000003000000060000BC0000004000000080000CD0000000000000090000TL00000000001000000000230000
|
I tried with TRLUPD option it is working for one record(AB) need solution for other records(BC,CD) and grand total and Amount
Code: |
000010 //STEP010 EXEC PGM=ICETOOL
000011 //TOOLMSG DD SYSOUT=*
000012 //DFSMSG DD SYSOUT=*
000013 //SORTIN DD DISP=SHR,DSN=TEST.INPUT
000014 //SORTOUT DD DSN=TEST.OUTPUT,
000015 // DISP=(NEW,CATLG,DELETE),
000016 // UNIT=SYSDA,DCB=*.SORTIN,SPACE=(CYL,(10,5),RLSE)
000017 //SYSOUT DD SYSOUT=*
000018 //TOOLIN DD *
000019 SORT FROM(SORTIN) TO(SORTOUT) USING(TST1)
000020 /*
000021 //TST1CNTL DD *
000022 OPTION COPY
000023 OUTFIL FNAMES=SORTOUT,
000024 INCLUDE=(1,2,CH,EQ,C'AB'),
000025 IFTRAIL=(HD=YES,TRLID=(1,2,CH,EQ,C'T1'),
000026 TRLUPD=(17:COUNT=(M11,LENGTH=7)))
000027 /* |
Thanks In advance for your help, let me know if need any other details. |
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
vvgoud,
*sigh* It is even here?? I just responded to your pvt email that you sent me.
Your details are a mess.
1. Your input does not match the expected output. Your sample input shows the amounts to be 20000 on all records but on the output you show different amounts for each record. What is the formula for the amounts to be changed to a different value?
2. You mention that the Amounts positions 11 to 19 total length=7 , but position 11 thru 19 will result in 9 bytes and not 7 bytes.
3. Your COBOL layout shows that Counts/Amount totals are an array of 15 occurrences. So do you need to calculate the record count and sum for all the 15 or just the 3 values you show here?
4. What version of DFSORT are you running? Please run the following job and show me the complete sysout which will help us determine the level of DFSORT your shop has
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
//* |
|
|
vvgoud
New User
Joined: 16 Aug 2007 Posts: 27 Location: Hyderabad
|
|
|
|
Hi Kolusu, Thanks so much for your quick reply, i sent reply to your email with updated details, please look and let me know if you need details. |
|