Page 1 of 1

How to split strinf using DFSORT ?

PostPosted: Wed Aug 22, 2007 5:27 pm
by kamal
Hi I am creating a report using SORT.

Here I am stuck with one problem.
The name is FULL NAME in
FIRSTNAME$LASTNAME format
e.g.
FULL NAME is : JIMI$ADAMS
here First NAME is JIMI and LAST NAME is ADAMS.

I have to populate FIRSTNAME and LASTNAME seperately.

How can FULL name be splitted in Last name and first name?

Re: How to split strinf using DFSORT ?

PostPosted: Wed Aug 22, 2007 9:20 pm
by Frank Yaeger
You can use DFSORT's PARSE function to do that. For example:

//S1    EXEC  PGM=ICEMAN                           
//SYSOUT    DD  SYSOUT=*                           
//SORTIN DD *                                       
JIMI$ADAMS                                         
FRANK$YAEGER                                       
MICKEY$MOUSE                                       
CHARLOTTE$SPIDER                                   
//SORTOUT DD SYSOUT=*                               
//SYSIN    DD    *                                 
  OPTION COPY                                       
  INREC PARSE=(%01=(ENDBEFR=C'$',FIXLEN=10),       
               %02=(ENDBEFR=C' ',FIXLEN=10)),       
  BUILD=(%01,X,%02)                                 


SORTOUT would have:

JIMI       ADAMS     
FRANK      YAEGER   
MICKEY     MOUSE     
CHARLOTTE  SPIDER   


For more information on DFSORT's PARSE function, see:

http://www.ibm.com/servers/storage/supp ... /mvs/peug/

Re: How to split strinf using DFSORT ?

PostPosted: Thu Aug 23, 2007 10:07 am
by kamal
Yes,this will do..Thanks Frank !

Re: How to split strinf using DFSORT ?

PostPosted: Thu Aug 23, 2007 9:02 pm
by Frank Yaeger
Glad I could help.