Page 1 of 1

search for a string

PostPosted: Wed Mar 02, 2016 1:17 am
by Daouchiche
Hi,

I would like to search for a string from one file and copy the next strings into another file. The string would be available anywhere in line between column 01 and 80.

Sample Input file -

sdjkghsioiojkljsd#89 kljsflkjklsfjlkjkljfs
Kl;fyhkl;hdf#104 lkujsdfjklhjkhsfkjlhfjk
Opietopiopujtrtioutriort#7895 klj;hhdf
jkdfhljklhsdfjklsdfjksdfkljkljhjkhdfjklhfd



Expected Output file -

89
104
7895


I found a way to search and copy the record using the INCLUDE statement.

 INCLUDE COND=(1,80,SS,EQ,C'#')


However, the requirement is just to copy the next strings until space, but NOT the complete record into output file as shown below.

Code'd

Re: search for a string

PostPosted: Wed Mar 02, 2016 1:27 am
by BillyBoyo
Have got the records you want, you use PARSE with STARTAFT for your search-string and ENDBEFR for blank, with FIXLEN for the maximum possible length, then BUILD using your PARSEd field.

Re: search for a string

PostPosted: Wed Mar 02, 2016 4:09 am
by NicC
Not a JCL question but a sort question. Moving topic. Next time you start a topic, please make sure that it is in the correct part of the forum.

Re: search for a string

PostPosted: Wed Mar 02, 2016 7:09 am
by Daouchiche
Thanks