Page 1 of 1

Sort Question

PostPosted: Thu Jul 28, 2011 5:30 pm
by rayngerfan
To Whom It May Concern:

I'm using this code to insert a record / line into members within a PDS that have 'PGM=INSYNC'. The below parameters work with the data
STEPLIB DD DSN=DYF.TEST.INSYNC.LOADLIB,DISP=SHR being writen on the next line after 'PGM=INSYNC'. Is there away to have the data writen after skipping two lines once 'PGM=INSYNC' is found?

OPTION COPY
OUTFIL IFTHEN=(WHEN=(15,13,CH,EQ,C'PGM=INSYNC'),
BUILD=(1,80,/,C'STEPLIB DD DSN=DYF.TEST.INSYNC.LOADLIB,DISP=SHR'))


Thanks

Re: Sort Question

PostPosted: Thu Jul 28, 2011 6:38 pm
by BillyBoyo
rayngerfan wrote:To Whom It May Concern:

I'm using this code to insert a record / line into members within a PDS that have 'PGM=INSYNC'. The below parameters work with the data
STEPLIB DD DSN=DYF.TEST.INSYNC.LOADLIB,DISP=SHR being writen on the next line after 'PGM=INSYNC'. Is there away to have the data writen after skipping two lines once 'PGM=INSYNC' is found?

OPTION COPY
OUTFIL IFTHEN=(WHEN=(15,13,CH,EQ,C'PGM=INSYNC'),
BUILD=(1,80,/,C'STEPLIB DD DSN=DYF.TEST.INSYNC.LOADLIB,DISP=SHR'))


Thanks


That's going to mess up your JCL (assuming that is what you have)? Do you want to do that?

You are already doing one "newline" in your code. Did you try sticking in a couple more?

Re: Sort Question

PostPosted: Thu Jul 28, 2011 10:23 pm
by enrico-sorichetti
the way I understand the question is ..
not to put empy ??? lines
but
input
//<stepnm> exec PGM=INSYNC,
// 1st continuation of the previous statement
// 2nd continuation of the previous statement

output
//<stepnm> exec PGM=INSYNC,
// 1st continuation of the previous statement
// 2nd continuation of the previous statement
//STEPLIB DD DISP=SHR,DSN=<datasetname>


or

input
//<stepnm> exec PGM=INSYNC,
// continuation of the previous statement

output
//<stepnm> exec PGM=INSYNC,
// continuation of the previous statement
//STEPLIB DD DISP=SHR,DSN=<datasetname>


depending on how the counting is done

Re: Sort Question

PostPosted: Thu Jul 28, 2011 11:55 pm
by BillyBoyo
Yes, enrico, that makes much more sense. I didn't get it.

If the second line of the continuation, or whatever it is that follows the "PGM=INSYNC" is also "standard", in that it is in the same position and same value, and does not occur elsewhere in the JCL, then you can use the technique you are already using, but change it to look for the different value.

If the same value, but not in fixed position you can scan.

However, you might not be that lucky. You might pick up something that is not from INSYNC if the second continuation is not unique to INSYNC.

If you have to rely on INSYNC, then you'll need a bit more jiggering about. Something like a sequence number set to 1000000 until you find INSYNC, when it can be set to 1. Then when the sequence is 3 (or two, depending on the counting) you can do your insert. Strip off the sequence numbers.

That is a broad approach. I'm sure it can be refined. Check how to define a GROUP or things like that.

I suspect you can even adjust it to do the insert after the first line which is not a continuation, though the ability to do inline comments in the JCL may cloud things.

If you show some samples of what it is you actually want, it'll help.

The more "standardised" your JCL is, the easier it is to change programatically.

Re: Sort Question

PostPosted: Fri Jul 29, 2011 3:13 am
by rayngerfan
I appreciate the feedback. Some of the PROCS that are being changed have a continuation after PGM=INSYNC.

EX:
// PGM=INSYNC,
// REGION=4096K,
// COND=(0,EQ,STEP1)

When I insert STEPLIB DD DSN=DYF.TEST.INSYNC.LOADLIB,DISP=SHR after 'PGM=INSYNC' the JCL is going to be messed up. If I can skip 2 lines after 'PGM=INSYNC' is found,then the text string //STEPLIB DD DSN=DYF.TEST.INSYNC.LOADLIB,DISP=SHR would be in the correct palce.


// PGM=INSYNC,
// REGION=4096K,
// COND=(0,EQ,STEP1)
//STEPLIB DD DSN=DYF.TEST.INSYNC.LOADLIB,DISP=SHR

Thanks

Re: Sort Question

PostPosted: Fri Jul 29, 2011 4:59 am
by BillyBoyo
Spot on enrico.

Plan A won't work either.

Are you going to dig into the manual and have a hack at Plan B yourself?

Re: Sort Question

PostPosted: Fri Jul 29, 2011 5:55 am
by rayngerfan
Since there is only 30 PROCS that have a continuation, I can change these manaually. I was curious if there was an easy way to skip 2 lines and then add the text. Thanks for everyone's input.

Re: Sort Question

PostPosted: Fri Jul 29, 2011 8:27 am
by dick scherrer
Hello,

I was curious if there was an easy way to skip 2 lines and then add the text.
Well, it would not be very difficult with code.

The lack of ease is the "rule" that it be done with your sort product. . .

Most folks would have done this with rexx or even program code if it was to be used in an ongoing basis. You posted your topic in the Syncsort part of the forum, so replies have been targeted to this.