how to replace some portion of record wit something

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

Moderators: Frank Yaeger, Moderator Group

Post Reply
User avatar
anilanju
Member
Posts: 47
Joined: Mon Nov 10, 2008 6:59 pm

how to replace some portion of record wit something

Post by anilanju » Tue Jan 20, 2009 9:47 pm

Hi All

I need help in sorting.

i have a file with header n records.

these are the records:

48BCG716SRAPINV
90ET6BTGSRAPINV
06BCC732SRAPINV

and i need to replace character from position 4 to postion 8 to AAA11, in all the records.

Urgent

Thanks
Anu

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

Post by Frank Yaeger » Tue Jan 20, 2009 11:54 pm

You can use a DFSORT job like the following to do what you asked for:

Code: Select all

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
48BCG716SRAPINV
90ET6BTGSRAPINV
06BCC732SRAPINV
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC OVERLAY=(4:C'AAA11')
/*
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

www.ibm.com/servers/storage/support/sof ... tmpub.html
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

User avatar
anilanju
Member
Posts: 47
Joined: Mon Nov 10, 2008 6:59 pm

Post by anilanju » Wed Jan 21, 2009 2:27 pm

HI

Thanks a lot.
It worked...

Thank you very much!

Regards
Anu

User avatar
anilanju
Member
Posts: 47
Joined: Mon Nov 10, 2008 6:59 pm

Post by anilanju » Wed Jan 21, 2009 4:05 pm

Hi

one more querry,this is done for all the records, but what should i do to exclude the header.

i dont want this change to be reflected to header.

what should be done to avoid it.

Thanks
Anu

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

Post by Frank Yaeger » Wed Jan 21, 2009 8:48 pm

That depends on what the "header" is. Can the header be identified in some way (e.g. '48' in positions 1-2) or can it only be identified as the first record? Is the header shown in your input example? If so, which record is it? If not, show a better example with the header.

Also, what is the RECFM and LRECL of your input file?
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

User avatar
anilanju
Member
Posts: 47
Joined: Mon Nov 10, 2008 6:59 pm

Post by anilanju » Wed Jan 21, 2009 9:21 pm

Hi

Yes the header is always the first record.

record lenght is 237
Block size: 27699

the header has alws F in first position.plus it is the first record also.

Along with this doubt, one more thing to ask.
48BCG716SRAPINV
90ET6BTGSRAPINV
06BCC732SRAPINV

is it possible to replace all BCG716 by DCB567

and ET6BTG by BSV345 in all the records present in file.

i mean not replacing all the chac by same thing but at same position replacing by diffrent codes.

Regards
Anu

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

Post by Frank Yaeger » Wed Jan 21, 2009 10:41 pm

Assuming that the constants you want to replace are in positions 3-8, you can use a DFSORT job like the following to do what you asked for:

Code: Select all

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
FHEADER
48BCG716SRAPINV
90ET6BTGSRAPINV
06BCC732SRAPINV
/*
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,NE,C'F'),
    OVERLAY=(3:3,6,CHANGE=(6,C'BCG716',C'DCB567',
     C'ET6BTG',C'BSV345'),NOMATCH=(3,6)))
/*
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

User avatar
anilanju
Member
Posts: 47
Joined: Mon Nov 10, 2008 6:59 pm

Post by anilanju » Thu Jan 22, 2009 3:29 pm

Hi

Thanks a lot, it worked.

Regards

Anu

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