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

Extract word from '_'


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

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Tue Feb 23, 2010 2:07 pm
Reply with quote

I try to extract a word from this character : '_'. I guess PARSE can do it, but how to go back on the record (there's no "GOBCKAT"=BLANKS) ?

(FB=80)

Code:
AAAA U V001_X_Y LLLLLLLLLLLLLL
A V1_Z OOOOO LLLLLLLLLLLLLLLLLLLL
VVVVVVVVVVV xxxx zz V2_CCC_PPP ZZZZZZZZ


must give :
V001_X_Y
V1_Z
V2_CCC_PPP
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Feb 23, 2010 5:40 pm
Reply with quote

Hi,

here is one way of getting the result
Code:
//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD *                               
AAAA U V001_X_Y LLLLLLLLLLLLLL               
A V1_Z OOOOO LLLLLLLLLLLLLLLLLLLL             
VVVVVVVVVVV XXXX ZZ V2_CCC_PPP ZZZZZZZZ       
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  SORT FIELDS=COPY                           
 INREC PARSE=(%00=(ENDBEFR=C' ',FIXLEN=20),   
              %01=(ENDBEFR=C' ',FIXLEN=20),   
              %02=(ENDBEFR=C' ',FIXLEN=20),   
              %03=(ENDBEFR=C' ',FIXLEN=20),   
              %04=(ENDBEFR=C' ',FIXLEN=20)), 
        BUILD=(%00,%01,%02,%03,%04)           
    OUTREC IFTHEN=(WHEN=(1,20,SS,EQ,C'_'),   
                 BUILD=(1,20)),               
           IFTHEN=(WHEN=(21,20,SS,EQ,C'_'),   
                 BUILD=(21,20)),                   
           IFTHEN=(WHEN=(41,20,SS,EQ,C'_'),       
                 BUILD=(41,20)),                   
           IFTHEN=(WHEN=(61,20,SS,EQ,C'_'),       
                 BUILD=(61,20)),                   
           IFTHEN=(WHEN=(81,20,SS,EQ,C'_'),       
                 BUILD=(81,20))                   
/*                                                 



Gerry
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
No new posts replace word 'MONTH' with current mon... SYNCSORT 11
No new posts optim extract file - SAS DB2 2
Search our Forums:

Back to Top