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

Sort help needed


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

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Jul 01, 2014 11:34 am
Reply with quote

Hi All,

I have input file with FB and length 80 bytes like below

Code:
C100   Arun, Suresh
C200   John, Sam, Leah.ron, Joe
C300   Raj


and i want the output in below format

Code:
C100   Arun
C100   Suresh
C200   John
C200   Sam
C200   Leah.ron
C200   Joe
C300   Raj


I tried using Parse but number of name which will be comma separated are unknown.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2014 12:43 pm
Reply with quote

Well, you need to use PARSE. You may not know how many, but you know the maximum (since your records are fixed-length).

If you use ICETOOL's RESIZE with USING(xxxx) and there PARSE the maximum to fixed positions, you can exclude any blanks on OUTFIL OMIT=/INCLUDE=.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Jul 01, 2014 2:56 pm
Reply with quote

Hello Bill,

Thanks for your input.
Code:
//TOOLIN DD *                                                       
  RESIZE FROM(IN) TO(OUT) TOLEN(60) USING(CPY1)                     
//CPY1CNTL DD *                                                     
  OPTION COPY                                                       
  OUTFIL PARSE=(%01=(ENDBEFR=C',',FIXLEN=20),                       
                %02=(ENDBEFR=C',',FIXLEN=20),                       
                %03=(ENDBEFR=C',',FIXLEN=20),                       
                %04=(ENDBEFR=C',',FIXLEN=20)),                       
  BUILD=(%01,/,1,4,%02,/,1,4,%03,/,1,4,%04),INCLUDE=(6,1,CH,NE,C' ')
/*           


But some changes required as output
Code:

C100 ARUN     
C100 SURESH   
C100         
C100         
C200 JOHN     
C200 SAM     
C200 LEAH.RON
C200 JOE     
C300 RAJ     
C300         
C300         
C300         


Please advise
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2014 3:50 pm
Reply with quote

You need OUTFIL OMIT= for where the name is blank.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Tue Jul 01, 2014 3:59 pm
Reply with quote

Tried but not working

Code:
//TOOLIN DD *                                     
  RESIZE FROM(IN) TO(OUT) TOLEN(60) USING(CPY1)   
//CPY1CNTL DD *                                   
  OPTION COPY                                     
  OUTFIL PARSE=(%01=(ENDBEFR=C',',FIXLEN=20),     
                %02=(ENDBEFR=C',',FIXLEN=20),     
                %03=(ENDBEFR=C',',FIXLEN=20),     
                %04=(ENDBEFR=C',',FIXLEN=20)),   
  OMIT=(6,1,CH,EQ,C' '),                         
  BUILD=(%01,/,1,4,%02,/,1,4,%03,/,1,4,%04)       
/*                         
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jul 01, 2014 5:00 pm
Reply with quote

Sorry, just flitting in and out, and didn't look at your code, just the output.

You need to do the PARSE on INREC, to make one long record with all your PARSEd fields on, noting that you need your 1,4 data prefixing each PARSEd field:

Code:
BUILD=(1,4,%01,1,4,%02,1,4,%03....)


You have 20 for your names, so you need the TOLEN to be 24. This will chop up your records into 24 bytes, and OUTFIL will see them one-at-a-time. So you have an OUTFIL just to do the OMIT (if you need final formatting, inserting of blanks perhaps, you can do it on BUILD in OUTFIL).

Check all the 20 bytes for space, else you can be trapped by a leading blank on a name.
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 Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top