Find and Replace @ Diff positions.

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
Posts: 43
Joined: Thu Oct 21, 2010 11:17 pm

Find and Replace @ Diff positions.

Post by hparthas » Fri Dec 02, 2011 11:11 pm

Hi All,

Can anyone help me with my requirement.

My output file contains some incorrect / invalid character I know its HEX values. But I need to replace these HEX values in 2 different ranges.

1) Input file (Sortin) is LRECL 128
2) RECFM = fb
3) First range is from 10-26
4) Second Range is from 70-86

If I find these hex values only between these 2 ranges I need to replace with spaces.

Invalid HEX are X'D5', X'4B', X'2B'. I need to replace this with X'40'

I know we can use FINDREP to change these one / more HEX values to spaces, I tried it and it worked, but found that I have these invalid values in other ranges and those also got replaced, since I dont want to change those values. I want to change only the values between 10-16 and 70-86.

Any help would be great.

Best Regards,

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

Post by Frank Yaeger » Fri Dec 02, 2011 11:41 pm

You can use STARTPOS=x and ENDPOS=y with FINDREP to limit the columns it searches. Something like:

Code: Select all

Frank Yaeger - DFSORT Development Team (IBM) -
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at

Post Reply


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.
Mainframe Interview questions

Other References
Mainframe Tools and others