View previous topic :: View next topic
|
Author |
Message |
harinair_kn Warnings : 2 New User
Joined: 27 Feb 2006 Posts: 16 Location: India
|
|
|
|
I have a requiremnt to check for a specific character in position 40-42 and if its present, i need to replace the characters in position 1-3 with number 521.
Eg: Input File : 514 ...............................ADS12345678
If "ADS" is present in position 40-42, I need to replace "514" in position 1-3 with "521" and copy the entire string to the output file. Can somebody help me here?
Thanks,
hari |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Have you tried INREC IFTHEN and OVERLAY? By the way, per your example the starting position is 36 and not 40-42:
Code: |
----+----1----+----2----+----3----+----4----+-
514 ...............................ADS12345678 |
|
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6---
514 ...................................ADS12345678
514 ...................................BDS12345678
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC OVERLAY=(1:40,3,CHANGE=(3,C'ADS',C'521'),NOMATCH=(1,3))
//* |
|
|
Back to top |
|
|
harinair_kn Warnings : 2 New User
Joined: 27 Feb 2006 Posts: 16 Location: India
|
|
|
|
Thnaks a lot for all your suggestions.Let me just test it out.. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Quote: |
Have you tried INREC IFTHEN and OVERLAY? |
Thank you for balling us out with CHANGE, SKolusu! |
|
Back to top |
|
|
|