How to replace a string for example ?01? to ?10? in a file using JCL.
I need only the particular position like 23rd column.
In the i/p file the values are with ?01? in column 23..
I need the o/p file with values ?10? in 23 column.
Give solution for this problem.
Let me know if you need more Information.
Thanks & Regards
Hari B
Enjoy your life today because yesterday had gone and tomorrow may
never come
You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see:
INREC IFTHEN=(WHEN=(23,2,CH,EQ,C'01'),OVERLAY=(23:C'10')) Hardcoding 10 is fine.If that position keeps changing each and every run,then how do we replace the changed variable in that position?
In the i/p file the values are with ?01? in column 23..
I need the o/p file with values in 23 column which keeps changing.
eg.,
1. if I need the system time in that position,then what do i do for that?
2.If i have the output dataset which contains some 2 character value which differs for each run.
Is it possible?
Since the field you want to replace can contain any value and can be at any position, I think better option is to write a cobol program which accepts following value in the linkage section
1. Field Start position
2. Field Lenght
3. Current value
3. replacement value
Use JCL to pass these parameters (Use Symbolic parameters).
In the given scenrio you would like to pass
1. Field Start position = 23
2. Field Lenght = 2
3. Current value = 01
4. replacement value = 10
in the program, check if position 23,2 contains current value.. then replace it by replacement value using move command...
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
rikshi,
Here's a DFSORT job that will do what you asked for:
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file1
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//SYSIN DD *
OPTION COPY
* Create a DFSORT symbol as follows:
* TARG,C'abcd'
* where abcd is the value in positions 1-4
OUTREC FIELDS=(C'TARG,C''',1,4,C'''',80:X)
/*
//S2 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//SORTIN DD DSN=... input file2
//SORTOUT DD DSN=... output file
//SYSIN DD *
OPTION COPY
* Use the TARG symbol created in S1 to do the overlay.
INREC IFTHEN=(WHEN=(1,4,CH,EQ,C'1234'),OVERLAY=(1:TARG))
/*