Replace value in dataset ?
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Job Control Language(JCL)

#1: Replace value in dataset ? Author: KM PostPosted: Thu Jan 27, 2005 2:47 pm
    —
Is it possible to replace one value with another in a dataset on a given line (start, length, etc ?).

#2:  Author: kolusuLocation: San Jose PostPosted: Thu Jan 27, 2005 2:58 pm
    —
KM,

Quote:

Is it possible to replace one value with another in a dataset on a given line (start, length, etc ?).


yes it is possible using CHANGE command in SORT or REPLACE/EDIT command of file-aid.

Post your reuqirement with a sample input and desired output. Also post the dataset attributes of input and output datasets along with position and length of the field to be replaced.

Kolusu

#3:  Author: KM PostPosted: Thu Jan 27, 2005 3:10 pm
    —
OK. Should have included in the first place....
File-Aid is not an option for me, so I'd have to go with the CHANGE cmd.

Example of input:

+AAAAAAAAAA 0000001234

Desired output:

+AAAAAAAAAA BBBBBB1234

In and output DS are FB and have Lrecl of 254.
Does that help ?

/KM

#4:  Author: kolusuLocation: San Jose PostPosted: Thu Jan 27, 2005 3:46 pm
    —
KM,

The following JCL will replace the zeroes present at pos 13 for a length of 6 bytes to bbbbbb at the same postion

Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
----+----1----+----2----+----3----+----4----+----5----+
+AAAAAAAAAA 0000001234   <==== your 254 lrecl file         
//SORTOUT  DD SYSOUT=*   
//SYSIN    DD *                                       
  SORT FIELDS=COPY                                     
  OUTREC FIELDS=(1,12,                                 
                 13,6,CHANGE=(6,C'000000',C'BBBBBB'),   
                 NOMATCH=(13,6),                       
                 19,236)                               
/*


If your intention is to hardcode BBBBBB for all the records at pos 13 then the following JCL will give the desired results.

Code:

//STEP0200 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                               
+AAAAAAAAAA 0000001234   <==== your 254 lrecl file                     
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  SORT FIELDS=COPY                             
  OUTREC FIELDS=(1,12,                         
                 C'BBBBBB',                   
                 19,236)                       
/*                                           


Hope this helps...

Cheers

kolusu

#5:  Author: OSCORP PostPosted: Thu Jan 27, 2005 3:53 pm
    —
KM,

CHANGE command will change the first occurance of the field you wish to change.
To change all the fields at a specific location to a specific value use CHANGE ALL command.

C '000000' 'BBBBBB' .A .B ALL

Here, .A & .B are the start and end lines

Regs
OsCorp

#6:  Author: KM PostPosted: Thu Jan 27, 2005 4:31 pm
    —
Excellent !
Thanks a lot !!!!



MVSFORUMS.com -> Job Control Language(JCL)


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group