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 Group of Records

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

New User


Joined: 06 May 2008
Posts: 96
Location: Delhi

PostPosted: Sun Jan 13, 2019 9:17 am    Post subject: Copy Group of Records
Reply with quote

Input File 1 [VB 1504 Bytes]

HEADER REC
2000A.....
REC1....
REC2....
2300....
REC3....
REC4....
.
.
RECN......
2000A
REC1....
REC2....
2300....
REC3....
REC4....
.
.
RECN...



FILE2 [10 Bytes FB]
1234567891
9876544211

I want to copy record where 10 BYtes key in File 2 match with 10 Bytes key present in record starting with 2300. Key position [15:10]

If key matches copy record starting from 2000A till next 2000A record.

Any suggestions ....
Back to top
View user's profile Send private message

Joerg.Findeisen

New User


Joined: 15 Aug 2015
Posts: 22
Location: Germany

PostPosted: Sun Jan 13, 2019 1:27 pm    Post subject:
Reply with quote

You first should propagate the KEYs to all records. This can be done when sorting in this step using an ID(A) and the SEQNUM(D). Sample:

Code:

//SORTIN   DD *                                             
2000A.....                                                   
REC1....                                                     
REC2....                                                     
2300KEY1                                                     
REC3....                                                     
REC4....                                                     
2000A.....                                                   
REC5....                                                     
REC6....                                                     
2300KEY2                                                     
REC7....                                                     
REC8....                                                     
/*                                                           
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(30:+0,TO=ZD,LENGTH=4)),   
    IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'2000A'),           
                PUSH=(20:ID=2,SEQ=8)),                       
    IFTHEN=(WHEN=GROUP,BEGIN=(1,4,CH,EQ,C'2300'),           
      END=(1,5,CH,EQ,C'2000A'),PUSH=(30:5,4))               
  SORT FIELDS=(20,10,ZD,D)                                   
  OUTREC IFTHEN=(WHEN=GROUP,KEYBEGIN=(20,2),PUSH=(30:30,4)) 
  END                                                       
/*


After that use e.g. another JOINKEYS step to find matching pairs with 'B' indicator and sorting after joining by ID(A) and SEQNUM(A) again. That should work I guess. But for sure there are better solutions available.
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 copy\replace the members in pr... abdulrafi JCL & VSAM 6 Fri Mar 22, 2019 7:02 pm
This topic is locked: you cannot edit posts or make replies. Copy one file to possible multiple files dibyendumandal11111 SYNCSORT 9 Fri Mar 08, 2019 2:47 am
No new posts Need help in adding Header to records senthamizh SYNCSORT 1 Thu Mar 07, 2019 7:55 pm
No new posts Count the records and Create Header a... thesumitk DFSORT/ICETOOL 2 Mon Mar 04, 2019 11:18 pm
No new posts how to copy a sequential dataset by u... javen777 JCL & VSAM 3 Thu Feb 21, 2019 11:37 pm

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