harithaganna
New User
Joined: 03 Jun 2008 Posts: 14 Location: chennai
|
|
|
|
Hi,
I have a problem in generaring the report? Can someone help me?
My input file contains 3 fields. field1=x(16), amt=pic s9(7)v99 comp-3, tran=x(4)
I/P:
field1 amt tran
xxx 50 4000
yyy 50 4001
aaa 50 4002
bbb 50 4000
ccc 50 4001
ddd 50 4004
I want to create report based upon the tran.
O/P:
field1 amt tran
xxx 50 4000
bbb 50 4000
sub tot:100 count:2
yyy 50 4001
ccc 50 4001
sub tot:100 count:2
aaa 50 4002
sub tot: 50 count:1
ddd 50 4004
sub tot: 50 count:1
grand tot:300 count:6 |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
My input file contains 3 fields. field1=x(16), amt=pic s9(7)v99 comp-3, tran=x(4) |
That means your fields would actually be like this:
field1 - positions 1-16 (CH)
amt - positions 17-21 (PD)
tran - positions 22-24 (CH)
Assuming you wanted to display the PD fields as ddddddd.dd corresponding to s9(7)v99, you could use a DFSORT job like the following:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/80)
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(22,4,CH,A)
OUTFIL REMOVECC,
BUILD=(1,16,17:17,5,PD,EDIT=(IIIIIIT.TT),X,22,4,80:X),
SECTIONS=(22,4,
TRAILER3=(7:'sub tot:',TOT=(17,5,PD,EDIT=(IIIIIIT.TT)),
32:'count:',COUNT)),
TRAILER1=(7:'grand tot:',TOT=(17,5,PD,EDIT=(IIIIIIT.TT)),
32:'count:',COUNT)
/*
|
SORTOUT would look like this:
Code: |
xxx 50.00 4000
bbb 50.00 4000
sub tot: 100.00 count: 2
yyy 50.00 4001
ccc 50.00 4001
sub tot: 100.00 count: 2
aaa 50.00 4002
sub tot: 50.00 count: 1
ddd 50.00 4004
sub tot: 50.00 count: 1
grand tot: 300.00 count: 6
|
|
|