Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to replace Trailer information with header information

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
somapradeep1

New User


Joined: 07 Sep 2010
Posts: 22
Location: hyderabad

PostPosted: Tue Feb 24, 2015 1:12 pm    Post subject: How to replace Trailer information with header information
Reply with quote

Hello,

I have a file like below.

Header 123456789 ABCDEFGHIJ
hello world
hello world
hello world
-
-
Trailer 11111111 XYZ12345678

So, the requirement is to update the particular position in trailer record with header information. Lets say XYZ to be updated with ABC
My final trailer would be like below...

Trailer 11111111 ABC12345678


Could anybody in the group please let me know how to achieve this by using SORT utility.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Feb 24, 2015 1:43 pm    Post subject: Reply to: How to replace Trailer information with header inf
Reply with quote

INREC IFHTHEN=(WHEN=GROUP it identify the header, then PUSH to a temporary extension of the record. IFTHEN=(WHEN=(logical-expression to identify the trailer, and copy the content from the extension. Use IFOUTLEN (fixed-length records) or BUILD to remove the extension.
Back to top
View user's profile Send private message
somapradeep1

New User


Joined: 07 Sep 2010
Posts: 22
Location: hyderabad

PostPosted: Tue Feb 24, 2015 2:24 pm    Post subject:
Reply with quote

Thanks Bill. If possible, Could you please provide me a sample code of the logic
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Feb 24, 2015 2:34 pm    Post subject: Reply to: How to replace Trailer information with header inf
Reply with quote

Code:
 INREC IFTHEN=(WHEN=GROUP,
                BEGIN=(1,6,CH,EQ,C'Header'),
                PUSH=(81:19,3)),
       IFTHEN=(WHEN=(1,7,CH,EQ,C'Trailer'),
                OVERLAY=(19:81,3)),
       IFOUTLEN=80


Should be close. That assumes fixed-length 80-byte records.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Tue Feb 24, 2015 2:52 pm    Post subject: Reply to: How to replace Trailer information with header inf
Reply with quote

Code:
 INREC IFTHEN=(WHEN=INIT,
                BUILD=(1,4,3X,5)),
       IFTHEN=(WHEN=GROUP,
                BEGIN=(8,6,CH,EQ,C'Header'),
                PUSH=(5:26,3)),
       IFTHEN=(WHEN=(8,7,CH,EQ,C'Trailer'),
                OVERLAY=(26:5,3))
 OUTFIL BUILD=(1,4,8)


That's for variable-length records. Done quickly, so fix any typos yourself if possible.
Back to top
View user's profile Send private message
somapradeep1

New User


Joined: 07 Sep 2010
Posts: 22
Location: hyderabad

PostPosted: Tue Feb 24, 2015 3:12 pm    Post subject:
Reply with quote

Excellent Bill. The logic is working fine. Thanks a lot!!! icon_biggrin.gif icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
No new posts Obtaining file information pahiker COBOL Programming 25 Tue Sep 27, 2016 7:25 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us