View previous topic :: View next topic
|
Author |
Message |
smileseenu
New User
Joined: 27 Sep 2006 Posts: 13 Location: India
|
|
|
|
My input is
H00000
D00020
D00030
D00025
T00000
output expected is, trailer should have sum of fields 2:5 from detail record
H00000
D00020
D00030
D00025
T00075 |
|
Back to top |
|
|
charanmsrit
New User
Joined: 25 Oct 2007 Posts: 81 Location: Australia
|
|
|
|
What are you expecting when your input is?
Code: |
H00000
D99991
D00005
D00004
T00000
|
|
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Please try below mentioned Sort Card
Code: |
SORT FIELDS=COPY
OUTFIL FNAMES=SORTOUT,
INCLUDE=(1,1,CH,EQ,C'D'),
IFTRAIL=(HD=YES,TRLID=(1,1,CH,EQ,C'T'),
TRLUPD=(2:TOT=(5,2,ZD,EDIT=(TTTTT))))
|
Input:
Code: |
H00012
D99991
D00005
D00004
T00000
|
Output:
Code: |
H00012
D99991
D00005
D00004
T00100
|
|
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
And how did you come to the conclusion that that peculiar arithmetic in fact fills the requirement? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
because the wrong position/lenghts were used
TRLUPD=(2:TOT=(5,2,ZD,EDIT=(TTTTT)))) |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
IOW, Sai didn't actually check heesh work, just saw that it ran to CC=0 and said, "Good enough!" |
|
Back to top |
|
|
saiprasadh
Active User
Joined: 20 Sep 2006 Posts: 154 Location: US
|
|
|
|
Quote: |
output expected is, trailer should have sum of fields 2:5 from detail record |
Sorry i didn't notice the 2:5 |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
saiprasadh wrote: |
Quote: |
output expected is, trailer should have sum of fields 2:5 from detail record |
Sorry i didn't notice the 2:5 |
Apart from that why do have an INCLUDE condition on OUTFIL? Unless I missed that there are other records(apart from the header and trailer), you don't really need the include condition.
smileseenu,
You need to expand the total field as the sum might cause an overflow with just 5 bytes. |
|
Back to top |
|
|
|