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 

Find specific string in file and copy x records

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


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Fri Aug 15, 2014 4:02 am    Post subject: Find specific string in file and copy x records Reply with quote

I imagine my requirement is simple, but all the examples I see seem to assume you want to replace values in the file.

Basically, I simply want to be able to find a specific string in a specific column in the file and then copy, say, 1000 records from that starting record.

How would I do this (or if you'd prefer, simply give me the keywords I need and I'll experiment on my own)
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Fri Aug 15, 2014 5:07 am    Post subject: Reply with quote

misi01,

You need a copy of this flowchart which explains the processing order for record handling, exits, statements, and options. Use this diagram with the text following it to understand the order DFSORT uses to run your job.

Code:

  OPTION COPY,STOPAFT=1000
  INCLUDE COND=(21,6,CH,EQ,C'MISI01')

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
misi01
Advanced


Joined: 02 Dec 2002
Posts: 629
Topics: 176
Location: Stockholm, Sweden

PostPosted: Fri Aug 15, 2014 5:15 am    Post subject: Thanks Kolusu. Reply with quote

I actually arrived at the same conclusionas your post. I'll just append my results so anyone else can find it as well
Code:

//* NOTE THAT THE STARTING COLUMN FOR THE INCLUDE COND IS 4 GREATER THAN 
//* COLS WOULD SHOW (SINCE THE INPUT FILE IS VARIABLE)             
//*                                                                 
//SYSIN    DD *                                                     
  INCLUDE COND=(45,11,CH,GE,C'00083411181')                         
  OPTION COPY,STOPAFT=1000                                         
//*                                                                 

(granted, it is the same as your append, but I'll bet people trip up over and over again on the actual extra 4 byte offset for variable files)
_________________
Michael
Back to top
View user's profile Send private message Send e-mail
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