|
View previous topic :: View next topic
|
| Author |
Message |
Selvarajars
New User
Joined: 21 Jun 2018 Posts: 7 Location: India
|
|
|
|
I need to remove the spaces in a VB record. I searched the forum, I am not able to get the correct solution. So posting this query.
Input:
GH ST|123|WESTBURY|WILLS|test111
|COUNCIL TAX BANDS|06010000079|
GH ST|123|WESTBURY|WILLS|test
|COUNCIL TAX BANDS|06010000079|
GH ST|123|WESTBURY|WILLS|test
|COUNCIL TAX BANDS|No Record found
Output should be like:
GH ST|123|WESTBURY|WILLS|test111|COUNCIL TAX BANDS|06010000079|
GH ST|123|WESTBURY|WILLS|test|COUNCIL TAX BANDS|06010000079|
GH ST|123|WESTBURY|WILLS|test|COUNCIL TAX BANDS|No Records.
Without spaces in between.
I tried using FINDREP and SQZ=(SHIFT=LEFT). It is not working out. Please help.
Thanks in advance. |
|
| Back to top |
|
 |
Selvarajars
New User
Joined: 21 Jun 2018 Posts: 7 Location: India
|
|
|
|
In the previous post, Input I have mentioned is wrong. Input will be something like this
Input:
| Code: |
GH ST|123 |WESTBURY |WILLS |test111 |COUNCIL TAX BANDS|06010000079|
GH ST |123 |WESTBURY |WILLS |test |COUNCIL TAX BANDS|06010000079|
GH ST|123 |WESTBURY |WILLS |test
|COUNCIL TAX BANDS|No Record found |
Output Expected:
| Code: |
GH ST|123|WESTBURY|WILLS|test111|COUNCIL TAX BANDS|06010000079|
GH ST|123|WESTBURY|WILLS|test|COUNCIL TAX BANDS|06010000079|
GH ST|123|WESTBURY|WILLS|test|COUNCIL TAX BANDS|No Records.
|
You obviously didn't read or possibly understand the part regarding use of the code tags - which when applied makes things so much clearer, doesn't it.
This is why we insist you use them. |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
Try this.
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
AA BB |CCDD|EEFF |
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,FINDREP=(IN=C' ',OUT=C'')),
IFTHEN=(WHEN=INIT,FINDREP=(IN=C' |',OUT=C'|'))
/* |
|
|
| Back to top |
|
 |
Selvarajars
New User
Joined: 21 Jun 2018 Posts: 7 Location: India
|
|
|
|
Hi Rohit,
Thanks a lot for your response.
I tried your code and it worked. The output now is
| Code: |
|TEST|COUNCILTAXBANDS|06010000096|20081010|20
|TEST|COUNCILTAXBANDS|NOMATCHINGRECORDSFOUND |
I still need a small change here. If you see the NO MATCHING RECORDS FOUND in the above response, there is no space in between. It needs to be like this
| Code: |
|TEST|COUNCIL TAX BANDS|06010000096|20081010|20
|TEST|COUNCIL TAX BANDS|NO MATCHING RECORDS FOUND. |
Please help me with the above. Meanwhile let me try something on the same.
Also please note that this position where this NO MATCHING RECORDS FOUND starts is not fixed. It varies.
I tried below code and it didn't work
| Code: |
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=1,ENDPOS=999,IN=C' |',OUT=C'|')) |
Thanks in advance.
Coded |
|
| Back to top |
|
 |
Rohit Umarjikar
Global Moderator

Joined: 21 Sep 2010 Posts: 3109 Location: NYC,USA
|
|
|
|
| How many spaces are there in between “NO MATCHING RECORD FOUND” ? I thought it’s just one space by looking at it. |
|
| Back to top |
|
 |
Selvarajars
New User
Joined: 21 Jun 2018 Posts: 7 Location: India
|
|
|
|
You are rite. Its just 1 space, but the output we got at the first instance is not have space at all.
I used below code,
| Code: |
OPTION COPY
OUTREC IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=1,ENDPOS=422,IN=C' |',OUT=C'|')),
IFTHEN=(WHEN=INIT,
FINDREP=(STARTPOS=1,ENDPOS=399,IN=C' ',OUT=C''))
|
and it worked now.
Thanks once again Rohit. Appreciate your timely help, it was much helpful.
CODED FOR YOU. Continual ignoring of posting guidlines could lead to topics being summarily locked |
|
| Back to top |
|
 |
|
|