Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
To remove spaces from a VB file using Sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Selvarajars

New User


Joined: 21 Jun 2018
Posts: 4
Location: India

PostPosted: Thu Jun 21, 2018 6:57 pm    Post subject: To remove spaces from a VB file using Sort
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: 4
Location: India

PostPosted: Thu Jun 21, 2018 7:01 pm    Post subject: Reply to: To remove spaces from a VB file using Sort
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

Senior Member


Joined: 21 Sep 2010
Posts: 1942
Location: NY,USA

PostPosted: Thu Jun 21, 2018 7:46 pm    Post subject:
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: 4
Location: India

PostPosted: Fri Jun 22, 2018 8:34 am    Post subject: Reply to: To remove spaces from a VB file using Sort
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

Senior Member


Joined: 21 Sep 2010
Posts: 1942
Location: NY,USA

PostPosted: Fri Jun 22, 2018 9:14 am    Post subject:
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: 4
Location: India

PostPosted: Fri Jun 22, 2018 10:04 am    Post subject: Reply to: To remove spaces from a VB file using Sort
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to manage VSAM file update confli... ocjohnh JCL & VSAM 2 Sat Jul 21, 2018 6:04 am
No new posts finding anydata between positions of ... ram_vizag SYNCSORT 13 Tue Jul 17, 2018 9:14 pm
No new posts Remove duplicate record with condition rajiv rengasamy DFSORT/ICETOOL 4 Wed Jul 11, 2018 3:55 pm
No new posts KSDS file fields update by passing va... Anil Kumar Prajapati TSO/ISPF 5 Wed Jul 11, 2018 5:59 am
No new posts Comparing inside same file vickey_dw DFSORT/ICETOOL 2 Tue Jul 10, 2018 9:51 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us