View previous topic :: View next topic
|
Author |
Message |
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
Hi,
I have file fb 80 ... I need to eliminate for example A in position 1-10, but keep the rest of the record on the same position ... not shift it if I remove A
12345A67 123456
to
1234567 123456
if I use FINDREP it shift last 123456 one position left if I remove A. |
|
Back to top |
|
|
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Assuming RECFM=FB and LRECL=80 and you want to replace the 'A' in column 1 to 10 with null, the below sort card should give you the desired output.
Code: |
OPTION COPY
INREC BUILD=(11,70,1,10)
OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C'')
OUTFIL BUILD=(71,10,1,70)
|
|
|
Back to top |
|
|
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
Thank you, but it's not what I am looking for. In other words - I need put additional blank before second 123456 only if I remove A .... second 123456 could be in any position in record ( this is just sample) . maybe in other words - I need to remove A in first word in the record and add one more blank between first word and second word in the record only if I remove A in first word |
|
Back to top |
|
|
mistah kurtz
Active User
Joined: 28 Jan 2012 Posts: 316 Location: Room: TREE(3). Hilbert's Hotel
|
|
|
|
Did you try running with that sort card.
Please post an actual sample of input and expected output. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
anatol wrote: |
Thank you, but it's not what I am looking for. In other words - I need put additional blank before second 123456 only if I remove A .... second 123456 could be in any position in record ( this is just sample) . maybe in other words - I need to remove A in first word in the record and add one more blank between first word and second word in the record only if I remove A in first word |
Perhaps if you could be bothered to tell us exactly what you really wanted, then the members that wish to help you will NOT be wasting their time giving incorrect solutions.
Maybe the expected output that you posted would have been a true reflection of what you wanted, but hey ho after 120+ posts YOU can't be arsed to use the code tags and then moan when the results aren't exactly to your spec.
Unfortunately psychic day was yesterday this week |
|
Back to top |
|
|
anatol
Active User
Joined: 20 May 2010 Posts: 121 Location: canada
|
|
|
|
Sorry, I need just idea, not full solution. Maybe I cannot explain the problem, but I've tried my best.
Here is the result of suggested sort statements:
Code: |
//STEP020 EXEC PGM=SORT,PARM='SIZE(MAX)'
//SORTIN DD *
12345A67 123456
123A45 123456
12A34 123456
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(11,70,1,10)
OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C'')
OUTFIL BUILD=(71,10,1,70)
|
output is:
Code: |
CPU: 0 HR 00 MIN 00.00 SEC SRB: 0 HR 00 MI
1234567 1 23456
12345 123 456
1234 1234 56
ICE201I 2 RECORD TYPE IS F - DATA STARTS IN POSITION 1
|
|
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Is the output what you want, if not, please show us what you want
Have you tried changing it to a blank, as below rather than a NULL ?
Code: |
//SYSIN DD *
OPTION COPY
INREC BUILD=(11,70,1,10)
* OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C'')
OUTREC FINDREP=(STARTPOS=71,ENDPOS=80,IN=C'A',OUT=C' ')
OUTFIL BUILD=(71,10,1,70)
|
|
|
Back to top |
|
|
RahulG31
Active User
Joined: 20 Dec 2014 Posts: 446 Location: USA
|
|
|
|
First, PARSE the input record to fixed positions and then use the above sort card. At the end, you need to use SQZ=(SHIFT=LEFT) to get the data in your original format again.
. |
|
Back to top |
|
|
|