remove leading special chars, space & trailing special char



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

remove leading special chars, space & trailing special char

Postby srihemz » Tue Jun 30, 2020 8:06 pm

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 :(
srihemz
 
Posts: 2
Joined: Tue Jun 30, 2020 7:28 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby srihemz » Tue Jun 30, 2020 9:08 pm

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
srihemz
 
Posts: 2
Joined: Tue Jun 30, 2020 7:28 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby sergeyken » Wed Jul 01, 2020 4:55 pm

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' '))
 
Javas and Pythons come and go, but JCL and SORT stay forever.
User avatar
sergeyken
 
Posts: 424
Joined: Wed Jul 24, 2019 10:12 pm
Has thanked: 7 times
Been thanked: 40 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post