|
View previous topic :: View next topic
|
| Author |
Message |
bhavan_hr
New User
Joined: 11 Mar 2005 Posts: 5
|
|
|
|
Hi,
I might be doing some crazy mistake, but I couldn't figure out what is causing this issue.
My input is a VB 904 file.
1. I've added SEQNUM of 9 ZD on column 5 of the VB file and eliminated certain detail records based on key matching with another filter file.
2. As a last step, I wanted to sort the file based on SEQNUM, update count on trailer record and get rid of SEQNUM I added. The issue here is the SEQNUM is getting removed on all but Trailer record.
Here is the SORT card I used.
| Code: |
SORT FIELDS=(5,9,ZD,A)
OUTFIL IFTRAIL=(TRLID=(55,1,CH,EQ,X'52'),
TRLUPD=(78:COUNT+1=(TO=BI,LENGTH=4))),
BUILD=(1,4,14)
|
Trailer record count is getting updated, Sequence number is removed on all records but retained on trailer record as shown below.
| Code: |
000000307 HRED rrærrrærrræ rrrærrræêrrrrrærræ DDAR
FFFFFFFFF0CDCC099999999999FFFFFFFFFFFFFFFF999999995999999999FFFF44444CCCD0001
00000030758954299C999C999CFFFFFFFFFFFFFFFF999C999C299999C99CFFFF000004419000C
|
Not sure what I am missing, appreciate if some one can point out...Thanks |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1439 Location: Bamberg, Germany
|
|
|
|
| From the manual:The trailer record will NOT be treated as a data record, that is, no other OUTFIL processing will be performed against the trailer record. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1439 Location: Bamberg, Germany
|
|
|
|
What you can try is:
| Code: |
SORT FIELDS=(5,9,ZD,A)
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,4,14)),
IFTRAIL=(TRLID=(n,1,CH,EQ,X'52'),
TRLUPD=(n:COUNT+1=(TO=BI,LENGTH=4))) |
Replace 'n' with updated positions and it should work as desired. |
|
| Back to top |
|
 |
bhavan_hr
New User
Joined: 11 Mar 2005 Posts: 5
|
|
|
|
Hi Joerg.Findeisen,
Thanks for you replies. I used your suggestion and replaced 'n' with correct positions. I still see SEQNUM in Trailer record but COUNT has its correct value.
| Code: |
SORT FIELDS=(5,9,ZD,A)
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,4,14)),
IFTRAIL=(TRLID=(55,1,CH,EQ,X'52'),
TRLUPD=(78:COUNT+1=(TO=BI,LENGTH=4)))
000000307 HRED rrærrrærrræ rrrærrræêrrrrrærræ DDAR
FFFFFFFFF0CDCC099999999999FFFFFFFFFFFFFFFF999999995999999999FFFF44444CCCD0001
00000030758954299C999C999CFFFFFFFFFFFFFFFF999C999C299999C99CFFFF000004419000C
|
I also tried with different values for n (reduced n by 9 as SEQNUM is eliminated by BUILD). Here, SEQNUM is removed from Trailer but COUNT is not getting updated.
| Code: |
SORT FIELDS=(5,9,ZD,A)
OUTFIL IFTHEN=(WHEN=INIT,BUILD=(1,4,14)),
IFTRAIL=(TRLID=(46,1,CH,EQ,X'52'),
TRLUPD=(69:COUNT+1=(TO=BI,LENGTH=4)))
HRED rrærrrærrræ rrrærrræêrrrrrærræ DDAR
0CDCC099999999999FFFFFFFFFFFFFFFF999999995999999999FFFF44444CCCD0003
58954299C999C999CFFFFFFFFFFFFFFFF999C999C299999C99CFFFF0000044190013
|
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1439 Location: Bamberg, Germany
|
|
|
|
I have to correct myself because it was looking good at first place. If the Trailer is identified as such, the SEQNUM can not be removed in OUTFIL using my suggested method. The quoted part from the manual stands correct.
What you can do instead (as I see you are not using OUTREC), put the BUILD=(1,4,14) in there and let the IFTRAIL do it's job in OUTFIL. |
|
| Back to top |
|
 |
bhavan_hr
New User
Joined: 11 Mar 2005 Posts: 5
|
|
|
|
| Thanks Joerg.Findeisen. Though not ideal, I retained SEQNUM for all records and added one additional step to remove SEQNUM. |
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1439 Location: Bamberg, Germany
|
|
|
|
I meant to update your code snippet as follows:
| Code: |
SORT FIELDS=(5,9,ZD,A)
OUTREC BUILD=(1,4,14)
OUTFIL IFTRAIL=(TRLID=(46,1,CH,EQ,X'52'),
TRLUPD=(69:COUNT+1=(TO=BI,LENGTH=4))) |
|
|
| Back to top |
|
 |
bhavan_hr
New User
Joined: 11 Mar 2005 Posts: 5
|
|
|
|
| Joerg.Findeisen wrote: |
I meant to update your code snippet as follows:
| Code: |
SORT FIELDS=(5,9,ZD,A)
OUTREC BUILD=(1,4,14)
OUTFIL IFTRAIL=(TRLID=(46,1,CH,EQ,X'52'),
TRLUPD=(69:COUNT+1=(TO=BI,LENGTH=4))) |
|
This works, thanks again Joerg.Findeisen.... :) |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|