View previous topic :: View next topic
|
Author |
Message |
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
I'm facing below challenge.
Code: |
//SRT02#20 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
JOBLWACA WAS EXPANDED USING PRIVATE LIBRARY AAA.BBB.CCC
DLYSTRT WAS EXPANDED USING PRIVATE LIBRARY DDD.EEE.FFF
CACS WAS EXPANDED USING PRIVATE LIBRARY GGG.HHH.III
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTREC PARSE=(%01=(STARTAFT=C'PRIVATE LIBRARY ',FIXLEN=30)),
BUILD=(1:C' DD DISP=SHR,DSN=',%01)
/* |
Output:
DD DISP=SHR,DSN=AAA.BBB.CCC
DD DISP=SHR,DSN=DDD.EEE.FFF
DD DISP=SHR,DSN=DDD.EEE.FFF
I want to input these DD's to ISRSUPC in batch mode.
I want output like below
NEW DD DISP=SHR,DSN=AAA.BBB.CCC
DD DISP=SHR,DSN=DDD.EEE.FFF
DD DISP=SHR,DSN=DDD.EEE.FFF
Could any one help me in inserting string "NEW" alone in 1st line.
LRECL = 150, FB In/Output files |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Put your PARSE and BUILD each within an IFTHEN=(WHEN=INIT.
Amend the BUILD to temporarily extend the records with a sequence number.
Use IFTHEN=(WHEN=(logical-expression to test the sequence number for a value of one. Use OVERLAY to put "NEW" or whatever where you want.
Use IFOUTLEN=original-record-length to chop your records back to original size. |
|
Back to top |
|
|
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Hi Bill,
I have searched forum, am not successful in getting exact example. Building temporary seqnum and checking in same sort card
Kindly share any example or link for my better understanding and for coding.
Thanks much for understanding |
|
Back to top |
|
|
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Hi Bill,
Do I need to use something like below
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,OVERLAY=(150:SEQNUM,3,ZD)),
IFTHEN=(WHEN=(150,3,CH,EQ,C'001'),
OVERLAY=(3:3,3,CH,EQ,C'NEW'))
OUTREC IFTHEN=(WHEN=INIT,PARSE=(%01=(STARTAFT=C'PRIVATE LIBRARY ',FIXLEN=30)),
BUILD=(1:C' DD DISP=SHR,DSN=',%01)) |
Correct me if am wrong anywhere
My files has 150 fb as properties.
And I don't understand IFOUTLEN=original-record-length to chop your records back to original size.
Please explain
Code'd |
|
Back to top |
|
|
Arunkumar Chandrasekaran
New User
Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
Hi Basha,
Please try this.
Code: |
//SYSIN DD *
OPTION COPY
OUTREC IFTHEN=(WHEN=INIT,
PARSE=(%01=(STARTAFT=C'PRIVATE LIBRARY ',FIXLEN=30)),
BUILD=(1:C' DD DISP=SHR,DSN=',%01,52:SEQNUM,3,ZD)),
IFTHEN=(WHEN=(52,3,ZD,EQ,1),OVERLAY=(1:C'NEW ')),
IFOUTLEN=51
/* |
By the way, why are you defining SEQNUM as CH ?? |
|
Back to top |
|
|
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Hi Arun,
OMG it just worked on a single run. I was breaking my head from two days since am new.
Thanks a million for your code.
Really I have learnt a lot since I registered in this forum.
Thanks Arun and Bill:) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Arunkumar Chandrasekaran,
For a ZD sequence number a character comparison will probably execute faster. That's why I use it :-)
Khadhar Basha,
IFOUTLEN= says "at the end of IFTHEN=(WHEN processing, set the record-length of the current record to this value". It is sometimes required, for complex IFTHEN usage, and often useful, to cut of temporary data in fixed-length records which is only used within that operator (if only used within INREC, or only OUTREC, or only OUTFIL) use IFOUTLEN rather than a BUILD (which requires data movement).
When extending a record, be careful of the column starts. 151: says "start at position 151", so you don't want to have 150: for extending 150-byte records. |
|
Back to top |
|
|
Arunkumar Chandrasekaran
New User
Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
Thanks for the information Bill.Thats new for me
Hi Basha,
Good it is working for you.Actually I just converted the words from Bill to SORT control statements
Cheers!! |
|
Back to top |
|
|
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Thanks Bill that was lots of information and learning.
Thanks Arun. Atlast gonna build my dynamic ISRSUPC JCL with dynamic input using above |
|
Back to top |
|
|
Arunkumar Chandrasekaran
New User
Joined: 01 Jun 2010 Posts: 63 Location: India
|
|
|
|
thats cool Basha. |
|
Back to top |
|
|
Khadhar Basha
New User
Joined: 28 Oct 2014 Posts: 44 Location: India
|
|
|
|
Hi All,
I am about to finish my tool but got stuck at one place.
Is there any way that i can add a header and trailer to the above sort.
I have tried to add
TRAILER1=('OUTDD DD DISP=SHR,DSN=ME')
At the bottom of IFOUTLEN=51
But it's throws error.
Please help
Thanks
Basha |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
You have to show the code and the sysout from the step. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Khadhar,
TRAILER1 is an OUTFIL subparameter and not OUTREC, I assume you have tried it with OUTREC, you might want to look at some OUTFIL TRAILER1 working examples here.
Similarly you can include a HEADER1 in the OUTFIL to write a report header. |
|
Back to top |
|
|
|