In JCL, normally Symbolic parameters is created using & (Ampersand sign) followed by the variable name.
But in dataset name, It has to followed by the dot sign after the variable name. Example:
//J&USER JOB 1
//MYSTEP EXEC PGM=MYPROG
//MYDATA DD DSN=&USER..MYCLASS.COOL
Why is that so? I am afraid of inconsistency later, so I ask this question. Thanks for any helps in advance.
In simple terms, if a symbolic parameter is followed by a period (.), then an additional period (.) needs to be added, thus resulting in 2 periods (.).
Based on your scenario, it is correct that you must use two periods (.).
This discussion said that the first period is used for concatenation, while some others said that it's part of the termination of the symbolic variable. But it doesn't really matter. The second period becomes part of the dataset name.
If &USER resolved as USR01, then it will be interpreted as
//JUSR01 JOB 1
//MYSTEP EXEC PGM=MYPROG
//MYDATA DD DSN=USR01.MYCLASS.COOL
Only the second period will be used in your dataset.
But, imagine if you have something like this, what will happen
//MYDATA DD DSN=&USER.MYCLASS.COOL
The dataset will be something like USR01MYCLASS.COOL. This is an error, as each level shouldn't have more than 8 characters.