View previous topic :: View next topic
|
Author |
Message |
sijayapal
New User
Joined: 23 Dec 2008 Posts: 69 Location: India
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
sijayapal
New User
Joined: 23 Dec 2008 Posts: 69 Location: India
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
sijayapal,
open your eyes, shut your mouth, read my post,
I provided the 'sample job'. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
sijayapal
New User
Joined: 23 Dec 2008 Posts: 69 Location: India
|
|
|
|
that's awesome... kolusu.
It really worked well
Mr.dbzTHEdinosauer i though u were kidding |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
i never kid - |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks to both Dick
I realised after submitting the job that I cant use RESIZE |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks Dick |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Thanks and Apologies Kolusu I did miss reading that |
|
Back to top |
|
|
|