Copy record when a particular string is present in it

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Captain Nero
Member
Posts: 10
Joined: Fri Jun 20, 2008 4:21 pm
Location: Kolkata, India

Copy record when a particular string is present in it

Post by Captain Nero » Thu Sep 04, 2008 2:58 pm

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.
Regards,
Captain N.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Thu Sep 04, 2008 8:04 pm

You can use DFSORT's substring search function like this:

Code: Select all

  OPTION COPY                        
  INCLUDE COND=(1,80,SS,EQ,C'ABCD')  
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others