Page 1 of 1

Copy record when a particular string is present in it

Posted: Thu Sep 04, 2008 2:58 pm
by Captain Nero
Hi,

I have a FB file of LRECL 80. There is a particular string 'ABCD' which can occur at any position starting form 1 to 77 in some the records. The others bytes may have different random values.

My requirement is to copy the records which has that particular string. I could have used a 77 INCLUDE statements one after another, but looking some better way of doing it.

The input file is like -

ABLKJDFLKSDJLFJABCD1GDFKSG7
ABCDOIHFOAIFHONCEWU1924932
OIEDHOWEFOINC12938443BCOBE
LAHFABCDPOWJEFPOWTRUTUERPU

Output file should be -

ABLKJDFLKSDJLFJABCD1GDFKSG7
ABCDOIHFOAIFHONCEWU1924932
LAHFABCDPOWJEFPOWTRUTUERPU

Can you please help me with it.

Posted: Thu Sep 04, 2008 8:04 pm
by Frank Yaeger
You can use DFSORT's substring search function like this:

Code: Select all

  OPTION COPY                        
  INCLUDE COND=(1,80,SS,EQ,C'ABCD')