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

How to replace Trailer information with header information


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Tue Feb 24, 2015 1:43 pm
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Tue Feb 24, 2015 2:34 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7310
Location: Inside the Matrix

PostPosted: Tue Feb 24, 2015 2:52 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replace HEX value with another HEX va... DFSORT/ICETOOL 8
No new posts How to replace a string dynamically i... CLIST & REXX 16
No new posts Remove additional information in SUPE... TSO/ISPF 10
No new posts Need to split single line into two li... DFSORT/ICETOOL 7
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14
Search our Forums:

Back to Top