SETVAR SUBSTR issue



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

SETVAR SUBSTR issue

Postby eastydl » Tue Mar 19, 2019 4:24 pm

Hi, I'm trying to run JCL where a 4 character variable &DLC is passed to it (along with others) but I just want to use the first 3 characters, I've tried to run the following creating a new variable SID with the first 3 characters of &DLC and then pass to the SEND step but it doesn't work, any help would be greatly appreciated, thanks

//*%OPC SCAN
//*%OPC SETVAR SID=SUBSTR(&DLC,1,3)
//*
//SEND EXEC PGM=DF080A00
//STEPLIB DD DSN=xxx.xxx.xxx,DISP=SHR
//SYSPRINT DD SYSOUT=*
//STATIONS DD DSN=xxx.xxx.xxx,DISP=SHR
//SYSIN DD *,SYMBOLS=JCLONLY
SID=&SID.,DSNOLD=&OFDSN.,
DSN=&VFN.
/*
eastydl
 
Posts: 5
Joined: Tue Mar 19, 2019 4:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SETVAR SUBSTR issue

Postby willy jensen » Tue Mar 19, 2019 8:51 pm

Say 'it doesn't work' is not particular useful, what excactly happens?
Seems you are mixing OPC variables and JCL variables.
I would suggest removing the ',SYMBOLS=JCLONLY ' from the SYSIN DD and maybe test it with an IEBGENER step.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: SETVAR SUBSTR issue

Postby eastydl » Tue Mar 19, 2019 9:27 pm

The variable SID is not resolved, thanks.
eastydl
 
Posts: 5
Joined: Tue Mar 19, 2019 4:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SETVAR SUBSTR issue

Postby willy jensen » Tue Mar 19, 2019 10:31 pm

Could you add another line :
SID=&DLC.,DSNOLD=&OFDSN.,
and verify that it expands correctly?
Please post the results.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: SETVAR SUBSTR issue

Postby eastydl » Tue Mar 19, 2019 10:49 pm

Thanks, I removed ,SYMBOLS=JCLONLY & run again & the output shows

SID=&SID.,DSNOLD=&OFDSN.,
DSN=SDARMAOW

ERROR: ERROR NEAR PARAMETER: SID
ACTION: ** REQUEST NOT ACCEPTED **

I guess DSNOLD doesn't resolve as SID fails but DSN does resolve ok
eastydl
 
Posts: 5
Joined: Tue Mar 19, 2019 4:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SETVAR SUBSTR issue

Postby willy jensen » Tue Mar 19, 2019 10:57 pm

How about an IEBGENER like this?

//SEND     EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT2   DD SYSOUT=*
//SYSUT1   DD *
DLC=&DLC
SID=&SID
DSNOLD=&OFDSN
DSN=&VFN
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: SETVAR SUBSTR issue

Postby eastydl » Tue Mar 19, 2019 11:16 pm

The job doesn't output anything
1DATA SET UTILITY - GENERATE
SYNCSORT COPY FEATURE CALLED - RC = 0
DLC=&DLC
SID=&SID
DSNOLD=&OFDSN
DSN=&VFN
eastydl
 
Posts: 5
Joined: Tue Mar 19, 2019 4:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SETVAR SUBSTR issue

Postby willy jensen » Tue Mar 19, 2019 11:53 pm

Well, it did output something, it clearly showed that the OPC, sorry TWS, variables were not resolved.
You did keep the '//*%OPC ' statements, right?
As there is no JOB statement, I assume that you look at the generated JCL through TWS?
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Re: SETVAR SUBSTR issue

Postby eastydl » Tue Mar 19, 2019 11:56 pm

Yep, kept the OPC statements in.
eastydl
 
Posts: 5
Joined: Tue Mar 19, 2019 4:11 pm
Has thanked: 0 time
Been thanked: 0 time

Re: SETVAR SUBSTR issue

Postby willy jensen » Wed Mar 20, 2019 12:30 am

So my earlier conclusion stays, none of the variables were resolved, thus not a problem with SUBSTR.
I'm no TWS expert, just used it from time to time, so I'm afraid that I can't help you.
willy jensen
 
Posts: 467
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 70 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post