MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Copy a number of records depending on the number and type

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
nandwana.kanishk886
Beginner


Joined: 16 Jun 2017
Posts: 1
Topics: 1

PostPosted: Fri Jun 23, 2017 7:23 am    Post subject: Copy a number of records depending on the number and type Reply with quote

Hi All,
Please spare me for making any mistake in my question.
I have to copy first thousand record from one file to another file depending on a condition
Record length for the file is 80,
File structure is as follows
Code:

12345 ABCDED GHIJKLMNOPQR111111111111111
12345 ABCDED GHIJKLMNOPQR222222222222222
12345 ABCDED GHIJKLMNOPQR333333333333333
22222 ABCDED GHIJKLMNOPQR444444444444444
22222 ABCDED GHIJKLMNOPQR555555555555555
22222 ABCDED GHIJKLMNOPQR666666666666666

for example my 1000th record is
Code:

22222 ABCDED GHIJKLMNOPQR555555555555555

then I need to copy till 12345 ABCDED GHIJKLMNOPQR333333333333333

Basically If I cannot all the records for the (1,5). I need to copy till the last key.
I want to do this by a jcl.
_________________
Kanishk Nandwana
Mainframe Developer
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12357
Topics: 75
Location: San Jose

PostPosted: Fri Jun 23, 2017 10:25 am    Post subject: Reply with quote

nandwana.kanishk886,

It is not clear as to what you want. Do you want to copy ALL the records till you find the key '22222' or do you want copy the first 999 records as 1000th record is '2222' ?

I am guessing that it is the first case and here is a JCL which will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
12345 ABCDED GHIJKLMNOPQR111111111111111               
12345 ABCDED GHIJKLMNOPQR222222222222222               
12345 ABCDED GHIJKLMNOPQR333333333333333               
22222 ABCDED GHIJKLMNOPQR444444444444444               
22222 ABCDED GHIJKLMNOPQR555555555555555               
22222 ABCDED GHIJKLMNOPQR666666666666666               
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
  OPTION COPY                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,5,CH,EQ,C'22222'),
                PUSH=(81:ID=1))               
         
  OUTFIL BUILD=(1,80),INCLUDE=(81,1,CH,EQ,C' ')       
//*


The output from this job is

Code:

12345 ABCDED GHIJKLMNOPQR111111111111111
12345 ABCDED GHIJKLMNOPQR222222222222222
12345 ABCDED GHIJKLMNOPQR333333333333333

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group