search for a string



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

search for a string

Postby Daouchiche » Wed Mar 02, 2016 1:17 am

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
Daouchiche
 
Posts: 14
Joined: Thu Jul 24, 2014 9:36 pm
Has thanked: 0 time
Been thanked: 0 time

Re: search for a string

 

Re: search for a string

Postby BillyBoyo » Wed Mar 02, 2016 1:27 am

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: search for a string

Postby NicC » Wed Mar 02, 2016 4:09 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2681
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 102 times

Re: search for a string

Postby Daouchiche » Wed Mar 02, 2016 7:09 am

Thanks
Daouchiche
 
Posts: 14
Joined: Thu Jul 24, 2014 9:36 pm
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post