View previous topic :: View next topic
|
Author |
Message |
maxsubrat
Active User
Joined: 27 Feb 2008 Posts: 110 Location: india
|
|
|
|
I have a input file which has a character A in 10th position.
I want to replace it to space in that 10th position.
But i have other character in the file in position 10th. i don't want to change that.
Also i have character A in other column and i don't want to disturb that.
Please someone try for a SORT.
Thanks |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
here is a couple of ways of doing this
Code: |
//ALTSEQ EXEC PGM=SORT
//SORTIN DD *
123456789A123456789
123456789B123456789
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
ALTSEQ CODE=(C140)
INREC OVERLAY=(10:10,1,TRAN=ALTSEQ)
/*
//OVERLAY EXEC PGM=SORT
//SORTIN DD *
123456789A123456789
123456789B123456789
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(10,1,CH,EQ,C'A'),OVERLAY=(10:C' '))
/*
|
Gerry |
|
Back to top |
|
|
maxsubrat
Active User
Joined: 27 Feb 2008 Posts: 110 Location: india
|
|
|
|
This is working..
I have another requirement :
I have few records and i want to replace one character to space based on some condition:
1. those records have L in the 1st character of the record and
2. those records have A in the 10th character.
Then i want to replace the 10th character from A to space.
Please someone help me out..
Thanks |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,1,CH,EQ,C'L',AND,10,1,CH,EQ,C'A'),
OVERLAY=(10:X))
/*
|
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000080 |
|
Back to top |
|
|
|