Write and Submit Your First JCL Job
Write a small JCL job in ISPF, submit it with the SUB command, find it in SDSF and read its return code and output, on z/OS 3.1 with JES2.

The first JCL job is the hurdle that makes the rest of the platform feel like a fortress, and it turns out to be about ten lines and four keystrokes. You write the job in a dataset, submit it, wait a few seconds and read what came back. This post walks through the whole round trip on z/OS 3.1 with JES2 and the ISPF editor: where to put the file, a job that prints a message, how to submit it, how to find the result in SDSF, and what to do when it fails. It assumes you can log on to a TSO session and reach the ISPF primary option menu, and it uses the user id STUDENT1 as an example, which you replace with your own.
Where the job lives
JCL is text in a dataset. The usual place for personal JCL is a partitioned dataset, a library of members, named with your user id as the first qualifier, for example STUDENT1.JCL. If you do not have one, create it from ISPF option 3.2 (Data Set Utility): enter the name, choose Allocate, and give it record format FB, record length 80, and a directory size of at least ten blocks. A member inside it is named like STUDENT1.JCL(HELLO).
To edit, choose ISPF option 2 (Edit), type the dataset name STUDENT1.JCL and the member name HELLO, and press Enter. You are in the editor with an empty screen and a line of ***** markers.
The first job
Type the following. The case matters little to the system, but JCL is conventionally written in capitals.
//STUDENT1 JOB (ACCT),'FIRST JOB',CLASS=A,MSGCLASS=X,
// NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT1 DD *
HELLO FROM MY FIRST JCL JOB
/*
//SYSUT2 DD SYSOUT=*Each line starts at column 1. The JOB statement names the job STUDENT1, and sites commonly require the job name to start with your user id or to be your user id plus one character, so use whatever your site requires. The EXEC statement runs IEBGENER, the copy utility. SYSUT1 DD * says the input data follows in the JCL itself, which is the single line HELLO FROM MY FIRST JCL JOB, ended by the /* delimiter. SYSUT2 DD SYSOUT=* sends the output to the printed output of the job, where you can read it. SYSIN DD DUMMY tells the utility to copy without changes.
Press PF3 to save and leave the editor, or type SAVE on the command line and press Enter.
Submitting
Reopen the member in the editor, type SUBMIT or the short form SUB on the command line at the top, and press Enter. ISPF sends the job to JES2 and shows a message:
JOB STUDENT1(JOB00247) SUBMITTEDThe number in parentheses is assigned by JES2 and differs for every job. Keep it in mind, since it identifies this run among others with the same name.
You can also submit from option 3.4 (Data Set List) by entering the dataset and typing SUB beside the member, or from the command line of any ISPF panel with TSO SUBMIT 'STUDENT1.JCL(HELLO)'.
Finding the result in SDSF
SDSF, the System Display and Search Facility, is where job output lives. From the ISPF menu choose the SDSF entry, or type TSO SDSF on the command line. Then:
Open the status display with
ST.Narrow the list to your jobs by typing
PREFIX STUDENT1*on the command line, orOWNER STUDENT1.Find the line for your job. Its columns include the job name, the job number, the job class, the position in the queue and a return code once it finishes.
Type
Sin the line'sNPcolumn beside the job and press Enter to open its output.
A finished job in ST shows RC=0000 in its return code column when all went well. You may need to press Enter on the command line again to refresh the display, since a job takes a moment to run.
In the output you see several datasets belonging to the job: the job log (JESMSGLG), a copy of your JCL as the system read it (JESJCL), system messages about allocation (JESYSMSG), and the output of the program, SYSPRINT and SYSUT2. Open SYSUT2 and you will find the text:
HELLO FROM MY FIRST JCL JOBThe SYSPRINT output lists what IEBGENER did, and the job log carries the lines that report completion:
IEF142I STUDENT1 STEP1 - STEP WAS EXECUTED - COND CODE 0000
$HASP395 STUDENT1 ENDED - RC=0000When it does not work
Three things go wrong in a first job, and each leaves a message that points to its fix.
A JCL error. The job never runs, ST shows a return code of JCL ERROR, and the job log says so. Open JESMSGLG or JESYSMSG and look for a message beginning IEFC. For example IEFC605I UNIDENTIFIED OPERATION FIELD means the system could not recognize the operation on a statement: the usual cause is a typing error in JOB, EXEC or DD, or a statement that begins in the wrong column. The message names the statement.
The job stays on the input queue. It was accepted but not run, usually because its class has no available initiator or the job was put on hold. Check the class with your site's documentation, and release a held job with the A line command in SDSF H display, or ask your system programmer.
The return code is nonzero. A return code of 4 means a warning, 8 an error, 12 a severe error. Open SYSPRINT first, since utilities write the reason there. Programs you write return their own codes by convention, as the COBOL posts on this site describe.
If the dataset you reference does not exist, the job log shows a message ending DATA SET NOT FOUND, from IEF212I, naming the job, step and DD name, and the step does not run.
Habits worth starting now
Keep a small set of known-good jobs in STUDENT1.JCL. A working job that copies, one that allocates a dataset and one that runs a program are the starting points for everything else, and copying a job is much faster than writing a new one. Add a comment line to each, with //* in columns 1 to 3, saying what it does.
Use TYPRUN=SCAN on the JOB statement when you are unsure about a job, as the later post on that option shows, to have the system check the syntax without running anything. And always read the job log, even when the return code is zero, because warnings that did not change the return code are in it.
When this does not fit
Some sites submit JCL through tools rather than ISPF: Zowe, IBM's z/OS Explorer, VS Code with the Zowe Explorer extension, or a scheduler. They do the same thing: they place JCL in the JES2 input queue, and fetch the output afterward. The statements are identical, and only the way you send and read them differs. If your site uses JES3 instead of JES2, the job log messages begin with different prefixes, and the SDSF display may differ, but the JCL does not.


