Jcl to replace characters in a DS

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
bhargavi_ns
Member
Posts: 18
Joined: Wed Sep 21, 2011 9:47 am

Jcl to replace characters in a DS

Post by bhargavi_ns » Thu Oct 13, 2011 7:27 pm

I/p ds :

HEADERxxxx1234xxxx
xxxxx
xxxxx
xxxxx
TRAILERxxxx1234xxxx

o/p :

HEADERxxxx5678xxxx
xxxxx
xxxxx
xxxxx
TRAILERxxxx5678xxxx

can anyone pls suggest me a JCL to get the above :?: ....

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Oct 13, 2011 9:03 pm

Show a more complete sample of the input data.

Explain the processing "rules" in sentence form.
Have a good one

bhargavi_ns
Member
Posts: 18
Joined: Wed Sep 21, 2011 9:47 am

Post by bhargavi_ns » Thu Oct 13, 2011 10:32 pm

I have a dataset in which there are 5 input records .
i want to replace the characters 1234 in the header record and trailer record (topmost and bottom record) by 5678 characters , in the same position.

i want a jcl which will replace the specified characters in the approriate position.

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 Oct 13, 2011 11:52 pm

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

Code: Select all

//S1 EXEC PGM=SORT                            
//SYSOUT DD SYSOUT=*                          
//SORTIN DD *                                 
HEADERxxxx1234xxxx                            
xxxxx                                         
xxxxx                                         
xxxxx                                         
TRAILERxxxx1234xxxx                           
//SORTOUT DD SYSOUT=*                         
//SYSIN DD *                                  
  OPTION COPY                                 
  INREC IFTHEN=(WHEN=(1,6,CH,EQ,C'HEADER'),   
    OVERLAY=(11:C'5678')),                    
   IFTHEN=(WHEN=(1,7,CH,EQ,C'TRAILER'),       
    OVERLAY=(12:C'5678'))                     
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

bhargavi_ns
Member
Posts: 18
Joined: Wed Sep 21, 2011 9:47 am

Post by bhargavi_ns » Fri Oct 14, 2011 8:14 pm

All Thanks to you Frank ..
I learnt Overlay parameter :D

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