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
 

 

Copy key from previous record till it encounters another key

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

Active User


Joined: 02 Jan 2009
Posts: 114
Location: Hyderabad

PostPosted: Wed Aug 26, 2015 7:47 pm    Post subject: Copy key from previous record till it encounters another key
Reply with quote

Code:

0155555
02ADRS1
02ADRS2
02ADRS3
0166666
02ADRS4
02ADRS5


Hi,

I have the file like above.
.
Bytes 1,2 identifies the record type. 01 record is the group head till it finds another 01 record.

All the 02 records belong to the previous 01 record type.

If record type is 01, then byte 3 thru 7 is the key.

Is there a way get the file like the below using sort/icetool?

Code:

555550155555
5555502ADRS1
5555502ADRS2
5555502ADRS3
666660166666
6666602ADRS4
6666602ADRS5


The key from 01 record has to be copied to all it's corresponding records (including that 01 record) till it finds another 01 record.

I found this can be done using inrec overlay for 01 record type alone. But can some please help me to get an idea on how to do this for all it's 02 records till it finds another 01 record.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Aug 26, 2015 7:58 pm    Post subject: Reply to: Copy key from previous record till it encounters another key
Reply with quote

Use IFTHEN=(WHEN=GROUP with BEGIN for the C'01' value and PUSH the key to the position you. The PUSH gets done for each record.
Back to top
View user's profile Send private message
kranthikumarb

Active User


Joined: 02 Jan 2009
Posts: 114
Location: Hyderabad

PostPosted: Wed Aug 26, 2015 8:36 pm    Post subject:
Reply with quote

Thanks Bill for a prompt response. How about this?

Code:

SORT FIELDS=COPY                                         
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,CH,EQ,C'01'),PUSH=(1:3,5))


I'm home, I cant test it till tomorrow morning.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Aug 26, 2015 10:36 pm    Post subject: Reply to: Copy key from previous record till it encounters another key
Reply with quote

That's along the right lines. Problem is that PUSH is like OVERLAY, so you need something to overlay:

Code:
  INREC IFTHEN=(WHEN=INIT,
              BUILD=(5X,1,length)),


and then your GROUP and PUSH, remembering in the PUSH that the position is five to the right of where it was originally.
Back to top
View user's profile Send private message
kranthikumarb

Active User


Joined: 02 Jan 2009
Posts: 114
Location: Hyderabad

PostPosted: Thu Aug 27, 2015 1:38 pm    Post subject:
Reply with quote

Thanks bill. I am ok to get the key at the end of each record also. So, I modified "push" accordingly.

Do you have any link where latest SORT manual is located. I would like to learn more about these advanced sort techniques.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Thu Aug 27, 2015 2:31 pm    Post subject: Reply to: Copy key from previous record till it encounters another key
Reply with quote

If you click on the DFSORT/ICETOOL link above your question, it'll take you to the forum itself, which includes a number of "stickies" you may find useful, as well as links to the documentation.
Back to top
View user's profile Send private message
kranthikumarb

Active User


Joined: 02 Jan 2009
Posts: 114
Location: Hyderabad

PostPosted: Fri Aug 28, 2015 9:47 am    Post subject:
Reply with quote

Thankyou. Links provided are very useful.
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts copy SEQ to PDS and create stats steve-myers JCL & VSAM 5 Thu Apr 27, 2017 1:15 am
No new posts Copy load modules and alias vasanthz IBM Tools 5 Thu Apr 20, 2017 6:31 am
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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