View previous topic :: View next topic
|
Author |
Message |
grayWolf
New User
Joined: 04 Oct 2010 Posts: 19 Location: Land of broken dreams
|
|
|
|
Hi All,
I have a sequential file with LRECL = 175.
I got a requirement to replace all the text from columns 129-140 in the PS to 'ABCDE'. The file has more than 50000 records.
I understand that this can be done with DFSORT and after a bit of research in this forum, I was able to learn about FINDREP in DFSORT. But this can't satisfy my requirement as it is a mass update and not depending upon any condition.
So how do I write a Sort card to achieve this?
Any help would be appreciated and please let me know if you need further information.
Thanks, |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Use OUTREC to build bytes 1-128, then your new text and then bytes 141-175
Which product are you using |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
since 129 to 140 is larger than 'abcde',
do you want the columns 129 to 140 replaced with
or do you want to reduce the record size? |
|
Back to top |
|
|
grayWolf
New User
Joined: 04 Oct 2010 Posts: 19 Location: Land of broken dreams
|
|
|
|
Quote: |
Which product are you using
|
I'm using Z/OS
Quote: |
or do you want to reduce the record size?
|
No. Want it with spaces as you suggested.
So, after some googling, I decided to use
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,128,129:C'ABCDE ',150:150,26) |
But is there any way to make it look "better". I mean, instead of "" C'ABCDE ' "", can we get 16 spaces in any other way.
Thanks |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
the fact that You are using zOS is irrelevant,
what is necessary to know is what sort product You are using!
dfsort or syncsort
the info You provided is mislieading
DFSORT questions get better reply on the DFSORT/ICETOOL section where the answers are provided by DFSORT developers
SYCNSORT question are handled here ( JCL section )
Run the code below and post the JES SYSOUT element so that we can see the sort product and release level that you have installed.
Code: |
//SORTSTEP EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ABC
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
|
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
there is syntax for literals with repeating characters.
there is also SYSNAMES, which would make your control statement really spiffy. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Wolf,
Quote: |
I got a requirement to replace all the text from columns 129-140 in the PS to 'ABCDE'. |
129-140 would be 12 characters.
This is 21 characters and would overlay 129-149, not 129-140. So it's not clear which positions you actually want to overlay.
If you want to overlay 129-140, you can use these DFSORT statements:
Code: |
OPTION COPY
INREC OVERLAY=(129:C'ABCDE',7X)
|
If you want to overlay 129-149, you can use these DFSORT statements:
Code: |
OPTION COPY
INREC OVERLAY=(129:C'ABCDE',16X)
|
|
|
Back to top |
|
|
grayWolf
New User
Joined: 04 Oct 2010 Posts: 19 Location: Land of broken dreams
|
|
|
|
Guys,
I was off during the weekends So, coming back to the question, we are using DFSORT and apologies for not posting it on the "DFSORT/ICETOOL section ". I'm pretty new to this forum as suggested by the "new user" tag.
Quote: |
129-140 would be 12 characters |
You nailed it right. It has to be 12 characters and we are padding it with spaces and if you had seen my previous post, I had used the following"
Code: |
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,128,129:C'ABCDE ',150:150,26) |
So I was looking for a better solution to this and your code:
Code: |
OPTION COPY
INREC OVERLAY=(129:C'ABCDE',16X)
|
really helped.
Thanks Frank! |
|
Back to top |
|
|
|