View previous topic :: View next topic |
Author |
Message |
KM Beginner
Joined: 22 Jul 2004 Posts: 18 Topics: 8
|
Posted: Thu Jan 27, 2005 2:47 pm Post subject: Replace value in dataset ? |
|
|
Is it possible to replace one value with another in a dataset on a given line (start, length, etc ?). |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Jan 27, 2005 2:58 pm Post subject: |
|
|
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 _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
KM Beginner
Joined: 22 Jul 2004 Posts: 18 Topics: 8
|
Posted: Thu Jan 27, 2005 3:10 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Thu Jan 27, 2005 3:46 pm Post subject: |
|
|
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 _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
OSCORP Beginner
Joined: 15 Oct 2004 Posts: 29 Topics: 8
|
Posted: Thu Jan 27, 2005 3:53 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
KM Beginner
Joined: 22 Jul 2004 Posts: 18 Topics: 8
|
Posted: Thu Jan 27, 2005 4:31 pm Post subject: |
|
|
Excellent !
Thanks a lot !!!! |
|
Back to top |
|
|
|
|