# JCL to search a string

Author Message
rahuindo

New User

Joined: 09 Apr 2008
Posts: 83
Location: Chennai

Posted: Tue Sep 24, 2013 3:49 am

Hi,
I have an input VB QSAM file and I need to copy the records which are having the string "RA00PF" or "RA00FP". These 2 strings can occur between the position 10 and 200 and are of 6-bytes in length. Currently, I am doing using the following:

 Code: // '          ORIF=(10,EQ,C''RA00PF''),   ', // '          ORIF=(10,EQ,C''RA00FP''),   ', // '          ORIF=(16,EQ,C''RA00PF''),   ', // '          ORIF=(16,EQ,C''RA00FP''),   ', // '          ORIF=(22,EQ,C''RA00PF''),   ', // '          ORIF=(22,EQ,C''RA00FP''),   ', // '          ORIF=(28,EQ,C''RA00PF''),   ', // '          ORIF=(28,EQ,C''RA00FP''),   ', // '          ORIF=(34,EQ,C''RA00PF''),   ', // '          ORIF=(34,EQ,C''RA00FP''),   ', // '          ORIF=(40,EQ,C''RA00PF''),   ', // '          ORIF=(40,EQ,C''RA00FP''),   ',

Is there a better way of doing this through JCL?
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

Posted: Tue Sep 24, 2013 4:01 am

Not with JCL.

You can do it with your SORT product, which we know is SyncSort

 Code: INCLUDE COND=(6,195,SS,EQ,C'RA00PF',              OR,6,195,SS,EQ,C'RA00FP')
rahuindo

New User

Joined: 09 Apr 2008
Posts: 83
Location: Chennai

 Posted: Tue Sep 24, 2013 4:14 am Thanks Bill. How will this work? As per my knowledge, "6" corresponds to the starting position and 195 will be the lenght of the string. So, will the above condition start searching at 6th position and look for the character "RAA0PF" for the next 195 bytes?
Bill Woodger

Moderator Emeritus

Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

Posted: Tue Sep 24, 2013 4:43 am

Yes, I didn't read your post clearly enought. So change the start and the length appropriately. Make sure you test values at and beyond the extremes.

The SS does a "Sub String" search for the character value being present anywhere within the field.

SS is even cleverer than that:

 Code: (1,1,SS,EQ,C'A,B,C')

Will search of any value of A, B or C in the one-byte field at position one. Look it up in your manual. Experiment.
 View Bookmarks All times are GMT + 6 Hours

 Topic Forum Replies Similar Topics Need to split single line into two li... DFSORT/ICETOOL 7 Members search in PDS JCL & VSAM 9 how to convert Hex String t char hex PL/I & Assembler 6 Get next 5 numeric from a string of '... COBOL Programming 4 RegEX search in ISPF editor TSO/ISPF 4
Search our Forums: