Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Sort help needed

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
guptae

Moderator


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

PostPosted: Tue Jul 01, 2014 11:34 am    Post subject: Sort help needed
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Tue Jul 01, 2014 12:43 pm    Post subject: Reply to: Sort help needed
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: 1187
Location: Bangalore,India

PostPosted: Tue Jul 01, 2014 2:56 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Tue Jul 01, 2014 3:50 pm    Post subject: Reply to: Sort help needed
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: 1187
Location: Bangalore,India

PostPosted: Tue Jul 01, 2014 3:59 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7234

PostPosted: Tue Jul 01, 2014 5:00 pm    Post subject: Reply to: Sort help needed
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us