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
 

 

Spllitting a record based on a value

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

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Thu Jun 14, 2012 1:40 am    Post subject: Spllitting a record based on a value
Reply with quote

Hi i have a requirement as below.

Code:
aaabbbcccdddeeefffzggghhhiiijjjzkkklllmmmnnn


Whenever i reach z i must split the rest of the record to next line...
The output should be something like this.

Code:
aaabbbcccdddeeefffz
ggghhhiiijjjz
kkklllmmmnnn


Is it possible to do in sort?
Back to top
View user's profile Send private message

Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 14, 2012 1:59 am    Post subject: Reply to: Spllitting a record based on a value
Reply with quote

sijayapal,

Basic Information needed

1. LRECL and RECFM of the input file
2. Max length of the field delimited by character 'Z'
3. Max Fields that can have Z as delimiter.
4. Last but not least run this sample Job and show me the Sysout. Look for this message
Code:
ICE201I ? RECORD TYPE IS F - DATA STARTS IN POSITION 1   
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 14, 2012 2:21 am    Post subject:
Reply with quote

Last but not least run this sample Job
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*
Back to top
View user's profile Send private message
sijayapal

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Thu Jun 14, 2012 2:55 am    Post subject:
Reply with quote

Hmmm LRECL=80
RECFM=FB
Quote:

2.Max length of the field delimited by character 'Z'
3. Max Fields that can have Z as delimiter.
Max length of the field delimited by character 'Z'

Its unknown... it can have Z or not at all..

Quote:
Last but not least run this sample Job and show me the Sysout. Look for this message

Please paste the job so that i can try
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 14, 2012 4:10 am    Post subject:
Reply with quote

sijayapal,
open your eyes, shut your mouth, read my post,
I provided the 'sample job'.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Jun 14, 2012 5:21 am    Post subject: Reply to: Spllitting a record based on a value
Reply with quote

Sijay,

I am sorry I did not provide the JCL but dbzTHEdinosauer graciously added the step I wanted you to run. Thank you dbzTHEdinosauer.

I guess you can use RESIZE to split the records like shown below. I assumed that you can have a max of 6 fields with delimited by Z. You can expand it upto 100 fields (100 fields is max for parse). Since your LRECL is only 80 , you can only have a max of 80 fields assuming that every character in the record is Z.

Code:

//STEP0100 EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD *                                                         
AAABBBCCCDDDEEEFFFZGGGHHHIIIJJJZKKKLLLMMMNNN                           
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
  RESIZE FROM(IN) TO(OUT) TOLEN(80) USING(CTL1)                         
//CTL1CNTL DD *                                                         
  SORT FIELDS=COPY                                                     
  INREC PARSE=(%01=(ENDAT=C'Z',FIXLEN=80),                             
               %02=(ENDAT=C'Z',FIXLEN=80),                             
               %03=(ENDAT=C'Z',FIXLEN=80),                             
               %04=(ENDAT=C'Z',FIXLEN=80),                             
               %05=(ENDAT=C'Z',FIXLEN=80),                             
               %06=(ENDAT=C'Z',FIXLEN=80)),                             
        BUILD=(%01,%02,%03,%04,%05,%06)                                 
                                                                       
  OUTFIL OMIT=(1,80,CH,EQ,C' ')                                         
//*


The output from the above job is
Code:

AAABBBCCCDDDEEEFFFZ                                                     
GGGHHHIIIJJJZ                                                           
KKKLLLMMMNNN                                                           
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
Back to top
View user's profile Send private message
sijayapal

New User


Joined: 23 Dec 2008
Posts: 69
Location: India

PostPosted: Thu Jun 14, 2012 8:06 pm    Post subject:
Reply with quote

that's awesome... kolusu.
It really worked well

Mr.dbzTHEdinosauer i though u were kidding icon_smile.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 14, 2012 8:12 pm    Post subject:
Reply with quote

i never kid -
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Jun 14, 2012 8:39 pm    Post subject:
Reply with quote

Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN DD *
RECORD
/*
//SORTOUT DD DUMMY
//SYSIN   DD   *
  OPTION COPY
/*


What does this step do ??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jun 14, 2012 8:46 pm    Post subject:
Reply with quote

http://ibmmainframes.com/viewtopic.php?t=33389
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jun 14, 2012 9:12 pm    Post subject:
Reply with quote

Hello,

Quote:
What does this step do ??
Submit it with a JOB card and look at the output. It will show the product release / ptf level.

You might also consider SORT as ICEMAN may or may not be found on the system.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Thu Jun 14, 2012 9:16 pm    Post subject:
Reply with quote

Thanks to both Dick

I realised after submitting the job that I cant use RESIZE icon_sad.gif
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Jun 15, 2012 4:33 am    Post subject:
Reply with quote

Hi,

if RESIZE is not available you can try this
Code:
//STEP0200 EXEC PGM=ICETOOL                                             
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD *                                                         
AAABBBCCCDDDEEEFFFZGGGHHHIIIJJJZKKKLLLMMMNNN                           
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)       
//OUT      DD SYSOUT=*                                                 
//TOOLIN   DD *                                                         
COPY FROM(IN) USING(CTL1)                                               
COPY FROM(T1) TO(OUT) USING(CTL2)                                       
//CTL1CNTL DD *                                                         
  OUTFIL FNAMES=T1,                                                     
        PARSE=(%01=(ENDAT=C'Z',FIXLEN=80),                             
               %02=(ENDAT=C'Z',FIXLEN=80),                             
               %03=(ENDAT=C'Z',FIXLEN=80),                             
               %04=(ENDAT=C'Z',FIXLEN=80),                             
               %05=(ENDAT=C'Z',FIXLEN=80),                             
               %06=(ENDAT=C'Z',FIXLEN=80)),                             
        BUILD=(%01,/,%02,/,%03,/,%04,/,%05,/,%06)                       
//CTL2CNTL DD *                                                         
  OMIT    COND=(1,80,CH,EQ,C' ')


Gerry
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jun 15, 2012 12:54 pm    Post subject:
Reply with quote

Thanks Gcicchet

It does work for me ..

But I was trying to understand why just till %06 PARSE What if there was more than 8 Z in a line or in other way how can we dynamically determine the parse statements?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jun 15, 2012 7:57 pm    Post subject:
Reply with quote

Hello,

I believe you have it "turned around".

The PARSE will determine where the Zs are. You would define the maximum number of Zs and use that many PARSE statements.

After PARSE(ing) the record, you might need to use different BUILD statements for different numbers of Zs. Yup, it could take a bit of code to ensure that "blank" lines were not generated in the output.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jun 15, 2012 9:46 pm    Post subject:
Reply with quote

Thanks Dick
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Jun 15, 2012 9:47 pm    Post subject:
Reply with quote

Pandora-Box wrote:
Thanks Gcicchet

It does work for me ..

But I was trying to understand why just till %06 PARSE What if there was more than 8 Z in a line or in other way how can we dynamically determine the parse statements?


Did you miss this statement in my post?

skolusu wrote:
I assumed that you can have a max of 6 fields with delimited by Z. You can expand it upto 100 fields (100 fields is max for parse). Since your LRECL is only 80 , you can only have a max of 80 fields assuming that every character in the record is Z.


As dick scherrer mentioned you code for the max parse fields and then eliminate the space records on OUTFIL. If you truly want a dynamic parse then you need to write an E15 or E35 exit which is similar to writing a program.
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri Jun 15, 2012 9:55 pm    Post subject:
Reply with quote

Thanks and Apologies Kolusu I did miss reading that
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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply yugendran COBOL Programming 5 Wed Oct 05, 2016 1:46 pm


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