Page 1 of 1

remove leading special chars, space & trailing special char

PostPosted: Tue Jun 30, 2020 8:06 pm
by srihemz
Hi All,

I have a fb file. in which one of the fields is "name" field (40 bytes length, starting position: 5). name field should start only with alphabets and trailing byte can have only dot or alphabets.
In other words, leading special characters/spaces must be removed; trailing special chars other than dot must be removed. whatever comes in between must be preserved.

Input:
1234*LAURA ANDERSON INC
1275 HARRY PETER,
1734" ER BHAR DIGITAL TRADE
4127' AUTO TRADE PACIFIC INC,,,,
1745"* AUTO CARE MOBILE INC,,,,...
0099OLIVER J. CLAURA & ASSOCIATES,
0456, INC

Output:
1234LAURA ANDERSON INC
1275HARRY PETER
1734ER BHAR DIGITAL TRADE
4127AUTO TRADE PACIFIC INC
1745AUTO CARE MOBILE INC,,,,...
0099OLIVER J. CLAURA & ASSOCIATES
0456INC


Could you please give some idea to try it out. As of now i tried using JFY=(SHIFT=LEFT) for removing leading spaces. but unable to get logic to remove any leading/trailing special chars. i wanted to try regular expression. unfortunately my company has V2R3 only :(

Re: remove leading special chars, space & trailing special c

PostPosted: Tue Jun 30, 2020 9:08 pm
by srihemz
OPTION COPY                                  
 OUTFIL PARSE=(%00=(FIXLEN=4),                
               %01=(STARTAT=MC,FIXLEN=40)),  
 BUILD=(%00,%01)                              





This removes leading special char/spaces. but for trailing part only yet to get solution. please help

Re: remove leading special chars, space & trailing special c

PostPosted: Wed Jul 01, 2020 4:55 pm
by sergeyken
1) There is no such thing as STARTAT=MC (at least in the widely known documentation); is that Mixed Case? Where is it implemented?

2) There are definitely two separate fields involved; do not mix them.

3) Any conversion can be done as early as possible: INREC...OUTREC...OUTFIL
INREC BUILD=(1,4,
             5,40,SQZ=(SHIFT=LEFT,PREBLANK=C',"*',MID=C' '))