IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

To remove spaces from a VB file using Sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Selvarajars

New User


Joined: 21 Jun 2018
Posts: 7
Location: India

PostPosted: Thu Jun 21, 2018 6:57 pm
Reply with quote

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
View user's profile Send private message
Selvarajars

New User


Joined: 21 Jun 2018
Posts: 7
Location: India

PostPosted: Thu Jun 21, 2018 7:01 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3109
Location: NYC,USA

PostPosted: Thu Jun 21, 2018 7:46 pm
Reply with quote

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
View user's profile Send private message
Selvarajars

New User


Joined: 21 Jun 2018
Posts: 7
Location: India

PostPosted: Fri Jun 22, 2018 8:34 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3109
Location: NYC,USA

PostPosted: Fri Jun 22, 2018 9:14 am
Reply with quote

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
View user's profile Send private message
Selvarajars

New User


Joined: 21 Jun 2018
Posts: 7
Location: India

PostPosted: Fri Jun 22, 2018 10:04 am
Reply with quote

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
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
No new posts Sorting date into YYYYMMDD, and creat... DFSORT/ICETOOL 13
No new posts Sort SMF records? SYNCSORT 6
No new posts To Sort detail records in a file with... SYNCSORT 5
No new posts To Populate Trailer cnt in the file w... SYNCSORT 1
Search our Forums:


Back to Top