Remove trailing spaces and replace a character



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

Remove trailing spaces and replace a character

Postby danny_ce16 » Wed Nov 16, 2011 2:42 pm

Hi,

i have a VB file of rec len 80 with the following recs.

C;007788999;TEST NAME NAME1                          ;14785/111111111111111
D;111222333;TESTNAME NAME23 NAME7                    ;25896/333333333333333
 ;321654987;TESTTEST NAME NAME4                      ;36912/555555555555555


i need to replace the first character with a number (C to 1, D to 2, anyother value including space to 3) and remove the trailing spaces that appears after the name, giving the output as below

1;007788999;TEST NAME NAME1;14785/111111111111111
2;111222333;TESTNAME NAME23 NAME7;25896/333333333333333
3;321654987;TESTTEST NAME NAME4;36912/555555555555555


Thanks in advance
danny_ce16
 
Posts: 15
Joined: Mon Oct 24, 2011 6:14 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Remove trailing spaces and replace a character

Postby BillyBoyo » Wed Nov 16, 2011 2:51 pm

Did you try to build with individual fields?

FINDREP is find-and-replace, I don't know if you have anything at all similar in your Syncsort manual.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Remove trailing spaces and replace a character

Postby danny_ce16 » Wed Nov 16, 2011 5:14 pm

im kinda struck in that find and replace part..

i used the sort card given by Frank, but that was for DFSORT and its showing error for FINDREP.

OPTION COPY                                                     
INREC IFOUTLEN=80,                                             
 IFTHEN=(WHEN=INIT,                                             
  BUILD=(1,4,5,1,CHANGE=(1,C'P',C'1',C'B',C'2',C' ',C'3'),     
    6,11,17,41,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'";',LENGTH=44),
    59,22)),                                                   
 IFTHEN=(WHEN=INIT,                                             
   BUILD=(1,4,5,80,SQZ=(SHIFT=LEFT,PAIR=QUOTE))),               
 IFTHEN=(WHEN=INIT,FINDREP=(IN=C'"',OUT=C''))                   


Without FINDREP, the output is coming as

1;007788999;"TEST NAME NAME1";14785/111111111111111
2;111222333;"TESTNAME NAME23 NAME7";25896/333333333333333
3;321654987;"TESTTEST NAME NAME4";36912/555555555555555


all i need now is to remove the 'double quotes' and display the data as

1;007788999;TEST NAME NAME1;14785/111111111111111
2;111222333;TESTNAME NAME23 NAME7;25896/333333333333333
3;321654987;TESTTEST NAME NAME4;36912/555555555555555
danny_ce16
 
Posts: 15
Joined: Mon Oct 24, 2011 6:14 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Remove trailing spaces and replace a character

Postby BillyBoyo » Wed Nov 16, 2011 9:00 pm

I don't have a Syncsort manual. Have you tried in yours?

Frank Yaeger's solution SQZ all the fields in one go.

If you can't find any Syncsort way, you could try something like the following, with the JFY for each of the fields individually. I have just hacked this out from what you tried, so I'm not saying it is correct, but just to give the idea.

OPTION COPY                                                     
INREC IFOUTLEN=80,                                             
IFTHEN=(WHEN=INIT,                                             
  BUILD=(1,4,5,1,CHANGE=(1,C'P',C'1',C'B',C'2',C' ',C'3'),     
    6,11,17,41,JFY=(SHIFT=LEFT,MID=' '),
    59,22))
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Remove trailing spaces and replace a character

Postby dick scherrer » Thu Nov 17, 2011 12:11 am

Hello,

This topic is being locked.

The original topic has been relocated to the Syncsort part of the forum.

As i mentioned there, FINDREP is supported by Syncsort and has been for someo time.

d
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post