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

How DFSORT able to to work in the scenerion by PARSE


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

New User


Joined: 02 Jan 2008
Posts: 11
Location: Malaysia

PostPosted: Tue Feb 28, 2012 10:20 pm
Reply with quote

Hi All,

I'm having a issue with my recent code to split my record into respective copybook field.

Here is my sample input

Sample Input:
Code:
1) abcd,,cdef,"New York, US","New business",Jason
2) abcd,,cdef,"New York, New Jersey,US",,Jason
3) abcd,,cdef,,"New Business",Jason


Expected output is
Code:
Record 1
field 1 = abcd
field 2 = spaces
field 3 = cdef
field 4 = New York, US
field 5 = New business
field 6 = Jason

Code:
Record 2
field 1 = abcd
field 2 = spaces
field 3 = cdef
field 4 = New York, New Jersey,US
field 5 = Spaces
field 6 = Jason

Code:
Record 3
field 1 = abcd
field 2 = spaces
field 3 = cdef
field 4 = Spaces
field 5 = New business
field 6 = Jason



My concern will be more on field 4 because if i use Parse stopaft comma, it will split the field New York, US into 2 different field.
At the same time I want to remove the " from the field4 and field5 in record 1 & 2

Is it possible to use a direct Parse to get the output as shown above?

Appreciate for the input from you.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Feb 28, 2012 10:26 pm
Reply with quote

did You notice that Your previous topic was edited to use for the data the code tags ? icon_evil.gif

and the same has been done with this one!

code tags use a fixed pitch font an make data more understandable

doing so from the beginning shows good manners
and saves the moderators time to edit poorly formatted posts
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Feb 28, 2012 11:10 pm
Reply with quote

adrianlmk,

Refer to PAIR=QUOTE

See if below works...Field lengths assumed....
Code:

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
abcd,,cdef,"New York, US","New business",Jason         
abcd,,cdef,"New York, New Jersey,US",,Jason           
abcd,,cdef,,"New Business",Jason                       
/*                                                     
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
  INREC IFTHEN=(WHEN=INIT,                             
        PARSE=(%01=(ENDBEFR=C',',FIXLEN=04),           
               %02=(ENDBEFR=C',',FIXLEN=04),           
               %03=(ENDBEFR=C',',FIXLEN=04),           
               %04=(ENDBEFR=C',',FIXLEN=27,PAIR=QUOTE),
               %05=(ENDBEFR=C',',FIXLEN=27,PAIR=QUOTE),
               %06=(ENDBEFR=C',',FIXLEN=20)),         
        BUILD=(%01,                                   
               %02,                                   
               %03,                                   
               %04,                                   
               %05,                                   
               %06)),                                 
        IFTHEN=(WHEN=INIT,                             
        FINDREP=(IN=C'"',OUT=C' '))                   
  OPTION COPY                                         
/*                                                     
//*                                                   

OUTPUT
Code:
abcd    cdef New York, US               New business              Jason
abcd    cdef New York, New Jersey,US                              Jason
abcd    cdef                            New Business              Jason

Thanks,
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Feb 29, 2012 2:45 am
Reply with quote

Please do not post in more than one forum at a time - it wastes your time and everyone else's. Apart from being considered rude.
Back to top
View user's profile Send private message
adrianlmk

New User


Joined: 02 Jan 2008
Posts: 11
Location: Malaysia

PostPosted: Wed Feb 29, 2012 4:47 am
Reply with quote

enrico-sorichetti wrote:
did You notice that Your previous topic was edited to use for the data the code tags ? icon_evil.gif

and the same has been done with this one!

code tags use a fixed pitch font an make data more understandable

doing so from the beginning shows good manners
and saves the moderators time to edit poorly formatted posts


Thanks Enrico for pointing out. I was searching for this code function to make it more easy to read but can't find it. I will be more careful next time.
Back to top
View user's profile Send private message
adrianlmk

New User


Joined: 02 Jan 2008
Posts: 11
Location: Malaysia

PostPosted: Wed Feb 29, 2012 4:49 am
Reply with quote

Nic Clouston wrote:
Please do not post in more than one forum at a time - it wastes your time and everyone else's. Apart from being considered rude.


Hi Nic, apologies as I do not have the intention to post twice because I thought I should post at the other topic since I looking for different type of solution. Will be more aware next time. Thanks
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: Wed Feb 29, 2012 5:41 am
Reply with quote

Ee did encourage adrianlmk to ask again in a a forum appropriate to his Sort, as that would provide a better solution than writing a thing in Cobol.
Back to top
View user's profile Send private message
adrianlmk

New User


Joined: 02 Jan 2008
Posts: 11
Location: Malaysia

PostPosted: Wed Feb 29, 2012 8:21 am
Reply with quote

sqlcode1,

Thanks. It working fine and really appreciate that.
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 Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top