Chidane
New User
Joined: 25 Nov 2021 Posts: 26 Location: India
|
|
|
|
Hi Team,
I have a file with LRECL=100 having multiple Header and Trailer
| Code: |
HEADERABCDE
123
234
345
9TRAIL0000009
HEADERZWSED
123
234
345
232
9TRAIL0000007
HEADERGFGFF
123
234
9TRAIL0000001
|
For some reason, the Trailer count is incorrectly populated after SORT is down in previous process. So I would like to generate Trailer count correctlyfor all the multiple Trailers.
I have used the following SORT card but it is applicable only for 1st Trailer and remainign records got removed. However I would like to have the Trailer count corectly calculated for each of the Trailer records.
Could you please help
| Code: |
OPTION COPY
OUTFILE FNAMES=OUTPUT1,
IFTRAIL=(HD=YES,TRLID=(1,6,CH,EQ,C'9TRAIL'),
TRLUPD=(7:COUNT=(M11,LENGTH=7))) |
|
|
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
According to your sample data, this seems good to me.
| Code: |
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(1,6,CH,EQ,C'HEADER'),
PUSH=(101:ID=8))
OUTFIL FNAMES=(SORTOUT),
OMIT=(1,6,CH,EQ,C'9TRAIL'),
REMOVECC,
SECTIONS=(101,8,
TRAILER3=(C'9TRAIL',COUNT-1=(M11,LENGTH=7))),
BUILD=(1,100)
END |
|
|