If you want to obtain the job identifier for a job, you must use an ENDREQ macro. see z/OS DFSMS Macro Instructions for Data Sets.
Issue an ENDREQ macro after writing a complete job to the internal reader. The job identifier is returned in the RPLRBAR field of the request parameter list (RPL). See z/OS JES2 Commands or z/OS JES3 Commands for details about the job identifier.
RPLRBAR is an 8-byte field. The first 3 bytes, xxx, are the characters JOB, TSU or STC. The remaining 5 bytes, nnnnn, represent the five digits of the job number. See z/OS JES2 Initialization and Tuning Guide or z/OS JES3 Initialization and Tuning Guide for more information.
If you submit JCL, and JES does not recognize it as a job, RPLRBAR contains blanks or a job id from an earlier job submitted through the internal reader.
OPTCD=(ADR,SEQ,SYN,NUP),RECLEN=80
Note that you must issue a CLOSE macro after the last ENDREQ.
The format of job numbers being displayed as part of command responses or messages can change depending on whether JES2 is set up to support greater than 65K jobs. When job numbers are potentially greater than 99,999, the format for job numbers is as follows: if the maximum allowed job number (high value of the JOBDEF RANGE= statement) is above 99,999, the job number format is J0nnnnnn. This format is used unless the job number range is decreased below 100,000. Similarly, STCnnnnn becomes S0nnnnnn and TSUnnnnn becomes T0nnnnnn.