IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

BUILD with IFTRAIL + TRLUPD


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhavan_hr

New User


Joined: 11 Mar 2005
Posts: 5

PostPosted: Thu Sep 24, 2020 3:38 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Sep 24, 2020 8:04 am
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Sep 24, 2020 9:03 am
Reply with quote

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
View user's profile Send private message
bhavan_hr

New User


Joined: 11 Mar 2005
Posts: 5

PostPosted: Thu Sep 24, 2020 8:07 pm
Reply with quote

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
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Sep 24, 2020 10:03 pm
Reply with quote

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
View user's profile Send private message
bhavan_hr

New User


Joined: 11 Mar 2005
Posts: 5

PostPosted: Thu Sep 24, 2020 10:30 pm
Reply with quote

Thanks Joerg.Findeisen. Though not ideal, I retained SEQNUM for all records and added one additional step to remove SEQNUM.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1231
Location: Bamberg, Germany

PostPosted: Thu Sep 24, 2020 10:56 pm
Reply with quote

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
View user's profile Send private message
bhavan_hr

New User


Joined: 11 Mar 2005
Posts: 5

PostPosted: Fri Sep 25, 2020 1:21 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts Build dataset list with properties us... PL/I & Assembler 4
No new posts Build a trailer with total an count SYNCSORT 6
No new posts Build two or more rows given some con... DFSORT/ICETOOL 9
Search our Forums:

Back to Top