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

To Populate Trailer cnt in the file with Multiple Trl record


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chidane

New User


Joined: 25 Nov 2021
Posts: 26
Location: India

PostPosted: Sun Sep 07, 2025 12:56 am
Reply with quote

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

Senior Member


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

PostPosted: Mon Sep 08, 2025 2:41 pm
Reply with quote

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

 


Similar Topics
Topic Forum Replies
No new posts Write record twice based on condition... SYNCSORT 7
No new posts Sort card to know that creation date ... DFSORT/ICETOOL 10
No new posts Convert CSV to flat file. DFSORT/ICETOOL 6
No new posts Multiple INSPECTS on a big size file COBOL Programming 6
No new posts Create a specific record/file based o... SYNCSORT 8
Search our Forums:


Back to Top