Page 1 of 2

System symbols in JCL

PostPosted: Fri Mar 11, 2016 1:30 pm
by Steve Coalbran
I tried to code an INCLUDE whose member name would change depending upon which system it ran.
For this I used the system symbol SYSNAME. Logically I thought an included member as in...
//ENVIRON  INCLUDE  MEMBER=ENVI&SYSNAME
...would work.
However this does not resolve the symbol and results in the JCL ERROR...
08.22.54 JOB62921  IEFC452I N472730S - JOB NOT RUN - JCL ERROR  917
------ JES2 JOB STATISTICS ------
           10 CARDS READ
           24 SYSOUT PRINT RECORDS
            0 SYSOUT PUNCH RECORDS
            1 SYSOUT SPOOL KBYTES
         0.00 MINUTES EXECUTION TIME
        1 //N472730S JOB (BWG0,T,I),'SYMTEST',CLASS=B,MSGCLASS=O,
          //         MSGLEVEL=(1,1),NOTIFY=&SYSUID
          IEFC653I SUBSTITUTION JCL - (BWG0,T,I),'SYMTEST',CLASS=B,MSGCLASS=O,MS
        2 //         EXPORT SYMLIST=(SYSNAME)
        3 //JOBPROC  JCLLIB ORDER=(N472730.USER.JCL)  ** REMOVE, MUST BE DEFAULT
        4 //ENVIRON  INCLUDE  MEMBER=ENVI&SYSNAME
.....
 STMT NO. MESSAGE
        4 IEFC642I EXCESSIVE PARAMETER LENGTH IN THE MEMBER FIELD
Similarly, if I modify the SYSOUT here...
      6 //SYSTSPRT DD SYSOUT=(*,,&SYSNAME)
.....
STMT NO. MESSAGE
       6 IEFC627I INCORRECT USE OF AMPERSAND IN THE SYSOUT FIELD
Ironically, the symbol is resolved when I code...
//         EXPORT SYMLIST=(SYSNAME)
//SYMTEST  EXEC PGM=IKJEFT1B
//SYSTSPRT DD SYSOUT=*
//SYSTSIN  DD *,SYMBOLS=EXECSYS
  HMIG     &SYSNAME..** WAIT EXTENDRC
/*
I can add a...
//         SET SYSNAME=MVS3
...after the EXPORT statement, of course, but this kind-of defeats the purpose.
For library management purposes I should like to use the already existing system symbol.

Am I doing it wrong or is JES2 just not designed to use system symbols in this way? :?
If there is something I'm missing and this can be achieved I'd be pleased to know how. :?:

Re: System symbols in JCL

PostPosted: Fri Mar 11, 2016 2:35 pm
by Aki88
Hello Steve,

I did a quick check on the messages guide, see if this helps:

IEFC627I INCORRECT USE OF AMPERSAND text
Explanation: In a JCL statement, the system found an ampersand in a parameter or field where an ampersand is not
permitted.
In the message text:
IN THE parameter FIELD
The keyword must be followed by an equal sign to be considered correctly specified.
In the message text:
parameter
The last correctly specified keyword parameter preceding the error.
ON THE cntr STATEMENT
The error was detected before any keyword parameters were processed. For example, an error was detected
in the name field of a statement.
In the message text:
cntr The statement on which the error occurred.
IN THE parameter1 SUBPARAMETER OF THE parameter2 FIELD
The error was detected in a subparameter. For example, SER is a minor keyword parameter that appears
only when associated with major keyword parameter VOLUME.
In the message text:
parameter1
The minor keyword parameter associated with a major keyword parameter.
parameter2
The major keyword parameter.
IN THE SYMBOLIC PARAMETER
The error was detected in the symbolic parameter.
IN THE VALUE FIELD OF THE SYMBOLIC PARAMETER
The error was detected in the field that assigns a value to a symbolic parameter.
IN THE parameter OVERRIDE FIELD
The error was detected in an override field.

In the message text:
parameter
An override keyword parameter on an EXEC statement.
System action: The system ends the job. The system scans the remaining job control statements for syntax errors.
The system issues messages about the job to the job log.
System programmer response: Look at the messages in the job log. If the JOB statement did not specify
MSGLEVEL=(1,1), specify it and run the job again. If the problem persists, search problem reporting data bases for a
fix for the problem. If no fix exists, contact the IBM Support Center. Provide the SYSOUT output for the job.
Programmer response: If the statement contains any incorrect characters, correct it. Submit the job again. The
possibility exists that a variable cannot be substituted because the scope of its assignment has been exceeded. If the
statement contains ampersands as part of a system symbol such as &SYSNAME., the job is running in a jobclass that
does not include SYSSYM=ALLOW. Select a different jobclass or contact the system programmer and ask for
SYSSYM=ALLOW to be added to the jobclass definition.

Source: Converter
Module: IEFCNDD, IEFCNEXC, IEFCNJOB, IEFCNPRC
Routing code: 2,10
Descriptor code: 4

Re: System symbols in JCL

PostPosted: Fri Mar 11, 2016 3:09 pm
by BillyBoyo
Interesting. I always thought plain batch jobs could not use system symbols directly (a Started Task can). SYSSYM=ALLOW I hadn't heard of.

Re: System symbols in JCL

PostPosted: Fri Mar 11, 2016 3:22 pm
by Aki88
Hello Billy,

I did a quick check in z/OS 1.13 JCL Reference, couldn't find a chapter on symbols; but same is very much present in 2.1; and the corresponding Messages guide; we are on 1.13 so cannot test it (1.13 it gives me an IEFC627I), if you have a 2.1 running can you do a test run on it please.

Re: System symbols in JCL

PostPosted: Fri Mar 11, 2016 4:12 pm
by Aki88
Hello Billy/Steve,

Was able to test it on a sister sandbox-site, they have 2.1 running, with almost all JOBCLASS set to SYSSYM=ALLOW; the symbolics are resolved normally as expected.

Re: System symbols in JCL

PostPosted: Fri Mar 11, 2016 4:18 pm
by BillyBoyo
Ah, it's new, so at least one explanation of how I haven't come across it.

It's a system set-up thing, so not something I'd be able to change even if I did have access to 2.1 :-)

So it looks like from 2.1 onwards you can get system symbols in ordinary batch jobs if the CLASS is set up to allow it. Now that I wrote that, I may have read over some reference to it before.

DFSORT has for a while been able to give access to system symbols for use as sort symbols.

Re: System symbols in JCL

PostPosted: Fri Mar 11, 2016 4:34 pm
by Steve Coalbran
Aki88 wrote:Hello Billy/Steve,
Was able to test it on a sister sandbox-site, they have 2.1 running, with almost all JOBCLASS set to SYSSYM=ALLOW; the symbolics are resolved normally as expected.

Thanks I will quiz my software guys!

Re: System symbols in JCL

PostPosted: Tue Mar 15, 2016 12:55 pm
by Steve Coalbran
UPDATE.
Hi guys, still waiting for systems architects to resolve this.
It made me wonder...

If one has a job that relies on having temporary datasets using a single ampersand (personally I disapprove of this but I suppose there may be valid reasons to continue to allow them?!), but if this value happens to also be the name of a system variable then you can have problems. It will likely resolve to a literal which is either an invalid datasetname or not defined to RACF(,ACF2,TS,...) but I thought... "there's a chance?".

If you go into SDSF you can issue a /DISPLAY SYMBOLS but you only get the first screenful and the display is non-scrollable and will disappear on pressing any key. :(

However to get a complete list of ones system variables available one can write a little bit of (you guessed it) REXX!!!
Something like this will trap a command output simply. :D
You can go deeper with ISFEXEC but here I used this I call ISFCMD which is simply this. It works as an EXEC or MACRO....
/* REXX - Execute command in REXX using SDSF/REXX                    */
ADDRESS ISPEXEC "CONTROL ERRORS RETURN "
ADDRESS ISREDIT "MACRO (COMMAND) NOPROCESS "
IF( RC<>0 )THEN ARG command
IF( command = '' )THEN command = 'ÅDA'   /* JES2 prefix is 'Å' X'5B' */
IF( ISFCALLS('ON')<>0 )THEN EXIT 99
ADDRESS SDSF "ISFEXEC '"command"' (WAIT"
DO i=1 TO isfulog.0; QUEUE isfulog.i; END
CALL ISFCALLS 'OFF'
ADDRESS TSO "QBROWSE VIEW"              /* external queue disp VIEW  */
which given /DISPLAY SYMBOLS as an argument. QBROWSE creates a temporary dataset and writes any QUEUED output to it. Any decent programmer should be able to knock up a QBROWSE but if you can't, just change the QUEUE to a SAY and cut&paste the output by displayed page. This can be a useful tool? No charge! ;)

Anyhow I found about 40 and put them into a test JOB to see how they would resolve by preceeding the references by SETs. (values chamged for security,obfuscation, and general overcomplication purposes!). I then submitted the job resolving the temporary dataset ? on SYSUT2 as each system variable respectively using SUB NX via a little REXX EditMacro (not supplied).
//N472730S JOB (SJ,T),CLASS=B,MSGCLASS=O,NOTIFY=&SYSUID
//         SET SYSALVL='3'
//         SET SYSCLONE='N0'
//         SET SYSNAME='MVS7'
//         SET SYSOSLVL='Z1020100'
//         SET SYSPLEX='PLEX7'
//         SET SYSR1='Z61XS0'
//         SET CCC='Z'
//         SET CEC='22'
//         SET CNMVER='X'
//         SET CNMVOL='Z61XS0'
//         SET COMCEC='C'
//         SET COMMSUF='00'
//         SET COUNTRY='SE'
//         SET DB2VER='d'
//         SET HRDWNAME='CFC33'
//         SET ICSFPROG='CFCINIT'
//         SET JESSVOL='SPL16'
//         SET JES2APPL='JESBNJE0'
//         SET JES2NODE='JESBSU0'
//         SET LOC='D'
//         SET LPARNAME='LP2207'
//         SET MASMEM='2'
//         SET MQEXIT='01'
//         SET MQLVL='712A'
//         SET MST1='1120'
//         SET OM='33'
//         SET OSLEVEL='020100'
//         SET PLEXID='P7'
//         SET PLPASUF='00'
//         SET PLX='61'
//         SET RMFOPT1=''
//         SET SMFID='MVS7'
//         SET SYSCAT='UCATP7'
//         SET SYSNBR='0'
//         SET SYSR2='Z61XS1'
//         SET USRPLEX='PLEX76'
//         SET USSROOT='Z61XS'
//         SET VMUSERID='+++++'
//         SET ZVER='X'
//*
//STEP1    EXEC PGM=ICEGENER
//SYSUT1   DD *
DATALINE
//SYSUT2   DD DISP=(,PASS,DELETE),DSN=?
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DUMMY
//
Each gave a JCL error.

Re: System symbols in JCL

PostPosted: Tue Mar 15, 2016 3:07 pm
by Aki88
Hello Steve,

Steve Coalbran wrote:If you go into SDSF you can issue a /DISPLAY SYMBOLS but you only get the first screenful and the display is non-scrollable and will disappear on pressing any key. :(

However to get a complete list of ones system variables available one can write a little bit of (you guessed it) REXX!!!
Something like this will trap a command output simply. :D


Another way would be to check 'ULOG'; once you've issued '/D SYMBOLS', and come out of the displayed screen, simply type 'ULOG' in SDSF, that should take you to: 'User session log', and voila, you get the complete output of the invoked command; quirky trick if one is too bored to write a REXX. :)

Re: System symbols in JCL

PostPosted: Tue Mar 15, 2016 3:28 pm
by Aki88
Hello Steve,

Steve Coalbran wrote:Each gave a JCL error.


<In continuation to last post; I exceeded the EDIT time limit for the post :oops: >

<Edit: Steve, I did a quick test on your JCL, instead of ICEGENER, I used the good old IEFBR14 as the only test being done is - if the symbols are resolved correctly post JCL submission (if the naming convention is adhered to be it a TEMP DS or a PS file, I think the symbolics will hold). One of the JCL piece looks as below (have removed the SET commands as they are were 'CTRL + C'/'CTRL + V' of your code :D )


//STEP1    EXEC PGM=IEFBR14                    
//FILE001  DD DSN=XXXX.AKI88.JUNK.TEST.A&SYSALVL,
//            DISP=(NEW,CATLG,DELETE),          
//            SPACE=(TRK,(1),RLSE),            
//            DCB=(RECFM=FB,LRECL=80)          
//*                                            
//FILE002  DD DSN=XXXX.AKI88.JUNK.TEST.A&OSLEVEL,
//            DISP=(NEW,CATLG,DELETE),          
//            SPACE=(TRK,(1),RLSE),            
//            DCB=(RECFM=FB,LRECL=80)          
//*                                                  
 


Which get resolved as:


XXXX.AKI88.JUNK.TEST.A3
and
XXXX.AKI88.JUNK.TEST.A020100
 


VMUSERID won't work as-is, as it goes anti-DS-naming-convention so one gets: IEFC626I INCORRECT USE OF PLUS IN THE DSN FIELD
Can you please share the JCL error message in case same was different.

Hth.