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

Editing First Line alone


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

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Mon Nov 24, 2014 6:30 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Nov 24, 2014 7:47 pm
Reply with quote

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
View user's profile Send private message
Khadhar Basha

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Tue Nov 25, 2014 11:29 pm
Reply with quote

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 icon_smile.gif
Back to top
View user's profile Send private message
Khadhar Basha

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Tue Nov 25, 2014 11:51 pm
Reply with quote

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
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 26, 2014 1:37 pm
Reply with quote

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
View user's profile Send private message
Khadhar Basha

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Wed Nov 26, 2014 2:43 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 26, 2014 3:10 pm
Reply with quote

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
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 26, 2014 3:38 pm
Reply with quote

Thanks for the information Bill.Thats new for me icon_smile.gif


Hi Basha,

Good it is working for you.Actually I just converted the words from Bill to SORT control statements icon_smile.gif


Cheers!!
Back to top
View user's profile Send private message
Khadhar Basha

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Wed Nov 26, 2014 3:50 pm
Reply with quote

Thanks Bill that was lots of information and learning.

Thanks Arun. Atlast gonna build my dynamic ISRSUPC JCL with dynamic input using above icon_smile.gif
Back to top
View user's profile Send private message
Arunkumar Chandrasekaran

New User


Joined: 01 Jun 2010
Posts: 63
Location: India

PostPosted: Wed Nov 26, 2014 3:56 pm
Reply with quote

thats cool Basha.
Back to top
View user's profile Send private message
Khadhar Basha

New User


Joined: 28 Oct 2014
Posts: 44
Location: India

PostPosted: Mon Dec 15, 2014 3:25 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Dec 15, 2014 5:34 pm
Reply with quote

You have to show the code and the sysout from the step.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 16, 2014 1:34 am
Reply with quote

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
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 Write line by line from two files DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts rewrite same SAY line CLIST & REXX 8
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
No new posts Repeat a DD line- comment and insert ... CA Products 3
Search our Forums:

Back to Top