zosjcl

Using the Jobname parameter in a Qualifier


I am trying to allocate a new Dataset using the Jobname in the Qualifier.

//JOBNAME  JOB  ACCOUNT,NOTIFY=&SYSUID
//STEP1    EXEC PGM=IEFBR14
//DD1      DD  DSN=MY.DS.&JOBNAME.,
//             DISP=(NEW,CATLG,DELETE),
//             SPACE=(TRK,(10,10)),
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=3200),
//             UNIT=SYSDA

However, I always get a JCL Error "incorrect use of Ampersand in the DSN Field". Is it not allowed to use the Jobname in a Qualifier? The Parameter is correctly resolved in the Qualifier. I could not find any information on it. Any help would be appreciated.


Solution

  • The jobclass that your job ran should be defined with SYSSYM=ALLOW , so that dynamic system symbols are converted.

    This can be queried with the command $DJOBCLASS(*),SYSSYM and set with The $TJOBCLASS(x),SYSSYM=ALLOW

    Alternatively you can try the system symbol &SYSJOBNM

    ie //DD1 DD DSN=MY.DS.&SYSJOBNM.,