Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 it is possible output a SET value fro... Martylin JCL & VSAM 5 Fri Sep 22, 2017 7:08 am
No new posts Fetch Previous month & year in MM... girishb2 DFSORT/ICETOOL 3 Thu Sep 21, 2017 9:54 pm
No new posts XMITIP sends it out. Can it copy on l... Rommel Dayon Rustia IBM Tools 0 Tue Sep 05, 2017 10:16 am
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us