CPF1338: Errors occurred on SBMJOB command
CPF1338 means the Submit Job (SBMJOB) command found errors and didn't submit the job. The text reads "Errors occurred on SBMJOB command." The diagnostic messages just before it in the job log say what was wrong.
Other names for this code
Also written as MSGCPF1338, CPF1338 errors occurred on SBMJOB command, SBMJOB failed AS400, SBMJOB CPF1338, iSeries CPF1338, MONMSG CPF1338.
What it means
SBMJOB builds a new batch job from several pieces. These include the job description, the job queue, the user profile the job runs under, the library list and any schedule date and time. Before it puts the job on the queue, it checks each piece. Each problem it finds is sent as a diagnostic message. When it's done, SBMJOB ends with CPF1338 as an escape message, and no job is submitted.
So CPF1338 is a summary. The cause is in the messages before it. A real example from the field shows "Specified date or time has passed" (CPF1634) followed by CPF1338. That job had a SCDDATE and SCDTIME that were already in the past. Another shows a library duplicated in the initial library list before CPF1338.
If the calling program doesn't monitor for CPF1338, it becomes a function check in that program.
Common causes
- The job description named in JOBD doesn't exist, or the user isn't authorized to it.
- The job queue named in JOBQ doesn't exist, isn't a valid name, or the user isn't authorized to it.
- The USER parameter names a profile the submitter isn't allowed to submit for. Submitting under another profile needs authority to that profile.
- The initial library list from the job description or INLLIBL has a duplicate library or a library that doesn't exist.
- The SCDDATE and SCDTIME given are already in the past (CPF1634 before CPF1338).
- A parameter built in a CL variable has stray blanks, such as a qualified name made with *BCAT.
How to find the problem
- Run
DSPJOBLOG, press F10 for detailed messages, and read the diagnostics just above CPF1338. - Press F1 on each diagnostic for the object or parameter it names.
- Check the job description with
DSPJOBD JOBD(lib/name), especially its user, job queue and initial library list. - Check authority with
DSPOBJAUTon the job description, job queue and the user profile named in USER. - In RPG, a MONITOR or ON-EXCP catches the escape but not the earlier diagnostics. Retrieve those with the QMHRCVPM API or a CL wrapper using RCVMSG.
How to fix it
- Correct the object or parameter named in the diagnostic messages, then submit again.
- Fix the initial library list in the job description, or pass a clean list with INLLIBL.
- Grant the needed authority to the job description, job queue or user profile with
GRTOBJAUT. - Calculate schedule dates and times so they are in the future, or let the job run straight away.
- Add
MONMSG MSGID(CPF1338)after SBMJOB in CL, and use RCVMSG to log the diagnostics before deciding what to do.
IBM documentation
IBM Display Message Descriptions (DSPMSGD). Use the documentation for your installed release.
This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.
Read the installed message description:
DSPMSGD MSGID(CPF1338) MSGF(QSYS/QCPFMSG)
Also inspect the full job log and second-level message text, including substitution values.
Related codes
Questions
Was my job submitted if I got CPF1338?
No. CPF1338 means SBMJOB stopped because of errors, so nothing was put on the job queue.
How do I see why SBMJOB failed?
Look at the diagnostic messages just before CPF1338 in the job log. They name the object or parameter that was wrong.
Can I catch CPF1338 in RPG?
Yes, as an exception. The diagnostics before it aren't exceptions, so retrieve them from the program message queue, for example with the QMHRCVPM API.