LEARN.COBOLSTACK.COM
//CS175  EXEC PGM=COURSE,PARM='CS175'

Developer track · Intro → Core · self-paced ~26h (5–6 weeks at 5h/week) · prerequisite: CS100

PL/I for z/OS: From Zero to Batch Programs

PL/I from zero to real batch programs on z/OS — no PL/I and no COBOL needed. In plain English and in short sessions: the shape of a program, declarations and data types — FIXED DECIMAL, FIXED BINARY, FLOAT, CHARACTER, VARYING, BIT and PICTURE — expressions and conversions, PUT and GET, IF, DO and SELECT, arrays, structures and based storage, the string and date built-ins, procedures and %INCLUDE, record files with JCL and DD, and ON-units. Thirteen sessions, thirteen programs, each one checked from your own job: by the last one you compile and bind a control-break report with your own procedure and run it from your own load library, and you can read a U4038 and its ONCODE.

Self-paced available Cohort

Open for enrollment now. No PL/I and no other programming language assumed — only CS100 Mainframe Foundations: you can log on, edit a member, submit a job and find its output. The lesson videos for this course are not recorded yet: every session below is published as its lessons and lab now and marked Coming soon until its videos are released. Where next: CS120 JCL & Batch for the JCL every batch program runs in, and CS165 Assembler On-Ramp for the layer underneath.

Plans: Free individual at no cost, or Paid individual at $249 per course, one-time — code review, extra exercises, grading and priority support.

//SYLLABUS DD DISP=SHR

Syllabus

Every session ends in a lab on your own environment. Labs are machine-checked against expected outputs — you and your L&D team always know exactly where you stand.

What PL/I is, and your first run

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. What PL/I is — IBM’s language built to do both business records and scientific arithmetic, with real data types, block structure and built-in error handling — and where it still runs: banks, insurers and governments with large nightly batch, and the estates being modernized now. Then your first run, before any theory: a job with three steps — PLI (the compiler, IBMZPLI), BIND (the binder, IEWL) and GO (your program) — and a program whose only work is one PUT SKIP LIST. You copy the frame around it as it is; Sessions 2 and 5 take it apart. Live on the system: the three step return codes, your line in the GO step’s SYSPRINT, and what a compile error looks like when a semicolon is missing.

LAB Type the deck into your own library, submit it, and find the three return codes and your line of output. Then change the text so that it contains your userid and run it again: PLI, BIND and GO all RC 0. Session 1 checkpoint (PL01), checked from your own job.

4 videos · ~22 min
  1. 1.1 What PL/I Is 5 min
  2. 1.2 Where PL/I Still Runs 5 min
  3. 1.3 Your First Run: Compile, Bind, Go 7 min
  4. 1.4 Lab: Make It Yours 5 min

The shape of a program

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. name: PROCEDURE OPTIONS(MAIN); and END name; — the external procedure every program is. Statements end at their semicolon, not at the end of the line; comments sit between /* and */; and the margins: the compiler reads columns 2 to 72 only, so a statement typed in column 1 loses its first letter. Blocks: a DO group bundles statements, a BEGIN block can declare its own names, and a label closes the block it names. And the tool used for the rest of the course: CALL PLIRETC(n) sets the return code the GO step ends with, so a program can say whether its answer was right.

LAB From a blank member, write program SHAPE in the right order — the PROCEDURE and END, a comment, a declaration, a labelled BEGIN block with its own variable, and CALL PLIRETC with a value of 7. GO must end RC 7. Session 2 checkpoint (PL02).

4 videos · ~23 min
  1. 2.1 PROCEDURE OPTIONS(MAIN) and END 5 min
  2. 2.2 Statements, Semicolons, Comments and Margins 6 min
  3. 2.3 Blocks and Labels: DO Groups and BEGIN 6 min
  4. 2.4 Lab: A Program from a Blank Member 6 min

Declarations and data types

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. DECLARE gives a name its type. FIXED DECIMAL(p,q) is an exact decimal number held as packed decimal — the type for money; PICTURE '99999' holds digits as printable characters. FIXED BINARY(31) is a fullword for counters and subscripts, FLOAT an approximate number with an exponent — never for money. CHARACTER(n) always holds n characters, padded or cut; CHARACTER(n) VARYING remembers its length; BIT(1) is PL/I’s yes/no switch. Live on the system: each type given a value and printed, with brackets that make the padding of a fixed string visible.

LAB Program TYPES declares one variable of each type with INITIAL — a price, a counter, a fixed and a varying string, a bit string and a picture — and prints them: 12.50, [AB ], [ADA] with its length 3, and 00042. GO RC 0. Session 3 checkpoint (PL03).

5 videos · ~29 min
  1. 3.1 DECLARE: Names and Attributes 5 min
  2. 3.2 FIXED DECIMAL: Business Numbers 6 min
  3. 3.3 FIXED BINARY and FLOAT 6 min
  4. 3.4 CHARACTER, VARYING and BIT 6 min
  5. 3.5 Lab: Declare and Show 6 min

Attributes, defaults, expressions and conversions

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. INITIAL, and the storage classes: AUTOMATIC storage is created on every call, STATIC once for the run. The defaults PL/I fills in — FIXED alone is FIXED DECIMAL(5,0) — and why every program in this course declares every name it uses. Arithmetic with exact precision: assignment cuts extra decimals, ROUND rounds them, DIVIDE says what precision a division gets. Conversions: text that holds a number converts by assignment, numbers are shown with PUT rather than joined into strings, and text that is not a number raises the CONVERSION condition.

LAB Program INVOICE converts a quantity given as text, multiplies it by a price, rounds a 7.5% tax to the cent and adds it: NET 45.00, TAX 3.38, TOTAL 48.38, and RC 0 only when the total is right. Session 4 checkpoint (PL04).

4 videos · ~25 min
  1. 4.1 INITIAL, Storage Classes and Defaults 7 min
  2. 4.2 Arithmetic and Precision 6 min
  3. 4.3 Conversions Between Types 6 min
  4. 4.4 Lab: An Invoice Line 6 min

Compile, bind and run with JCL

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. The deck you have submitted since Session 1, now line by line. The PLI step runs IBMZPLI: SYSIN is your source, SYSPRINT the listing, SYSLIN the object deck it passes on. The BIND step runs the binder, which turns the object deck into a load module in SYSLMOD, taking run-time routines from the Language Environment library on SYSLIB. The GO step runs that module, and COND skips the later steps when an earlier one failed. Then the listing as a tool: the numbered source, and the messages — a number, a severity letter and a text — where I, W, E and S mean return codes 0, 4, 8 and 12. The method that always works: fix the first message first.

LAB Program FIXME arrives with three errors — a misspelled keyword, a missing semicolon and a string with its closing quote missing. Fix each one from the listing’s messages until PLI ends RC 0 and GO prints TOTAL IS 9 and FIXED AT LAST. Session 5 checkpoint (PL05).

4 videos · ~24 min
  1. 5.1 Three Steps, Three Programs 5 min
  2. 5.2 The Deck, Line by Line 7 min
  3. 5.3 Reading the Compiler Listing and Its Messages 6 min
  4. 5.4 Lab: Fix Three Errors 6 min

Stream output and input: PUT and GET

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. PUT SKIP LIST for a quick look at values, with SKIP, PAGE and LINE for lines and pages. PUT EDIT to place every value exactly: A, F(w,d), X and COLUMN. A picture as a template for money on the page — P'ZZZ,ZZ9V.99' prints 1234.50 as 1,234.50 with the leading zeros suppressed. GET LIST reads values from the GO step’s SYSIN and converts each one to its variable’s type, and PUT DATA prints names with their values, the quickest way to see what a variable holds.

LAB Program STREAM reads a quantity, a price and an item name from in-stream data with GET LIST, computes the amount and prints ITEM WIDGET … AMOUNT 12.75 with PUT EDIT and a P format, then the quantity with PUT DATA. GO RC 0. Session 6 checkpoint (PL06).

5 videos · ~30 min
  1. 6.1 PUT LIST, SKIP, PAGE and LINE 5 min
  2. 6.2 PUT EDIT: Format Items A, F, X and COLUMN 7 min
  3. 6.3 PICTURE and the P Format: Money on the Page 6 min
  4. 6.4 GET LIST from SYSIN, and PUT DATA 6 min
  5. 6.5 Lab: A Formatted Line from Input 6 min

Decisions and loops: IF, DO and SELECT

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. IF … THEN … ELSE, with a DO group when more than one statement belongs to the IF; the comparisons and &, | and NOT (¬ in IBM’s manuals, typed ^); a comparison is a bit, so a BIT(1) switch is tested directly. Loops: DO I = 1 TO n BY k, DO WHILE (tested first) and DO UNTIL (tested last), and why the loop variable is FIXED BINARY. SELECT with WHEN and OTHERWISE, where the first true WHEN wins and the order matters; LEAVE and ITERATE inside a loop. And the trap of a language where = is both assignment and comparison.

LAB Program LOOPS classifies the numbers 1 to 15 with a SELECT inside a DO loop — FIZZ 4, BUZZ 2, BOTH 1, OTHER 8 — then doubles a value with DO WHILE until it passes 100 (128 in 7 steps), and ends RC 0 only when the counts are right. Session 7 checkpoint (PL07).

4 videos · ~25 min
  1. 7.1 IF, THEN, ELSE and Comparisons 6 min
  2. 7.2 DO Loops: TO, BY, WHILE and UNTIL 6 min
  3. 7.3 SELECT, WHEN, OTHERWISE; LEAVE and ITERATE 6 min
  4. 7.4 Lab: Count and Classify 7 min

Arrays, structures and based storage

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. Arrays with their bounds, HBOUND, DIM and SUM, walked in a loop without a hard-coded size. Structures with level numbers, the record layout of PL/I, and qualified names. Arrays of structures as tables of records, and LIKE to copy a layout. Then BASED storage and pointers at the level batch code uses them: BASED(ADDR(x)) lays a structure over the bytes of another variable — a date taken apart into year, month and day without moving a byte — and ALLOCATE and FREE shown once for a based structure of its own.

LAB Program TABLES totals an array of five sales with a HBOUND loop, counts the big ones, cross-checks the total with SUM in a branch structure and reads the month and day of a run date through a based overlay: ENTRIES 5 TOTAL 260.49, BIG SALES 2, MONTH 11 DAY 15, RC 0. Session 8 checkpoint (PL08).

5 videos · ~31 min
  1. 8.1 Arrays: Bounds, Subscripts, HBOUND, DIM and SUM 6 min
  2. 8.2 Structures: Levels and Qualified Names 6 min
  3. 8.3 Arrays of Structures and LIKE 6 min
  4. 8.4 BASED Storage and Pointers 7 min
  5. 8.5 Lab: A Sales Table 6 min

Built-in functions for strings and dates

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. SUBSTR, LENGTH and || to cut and join strings, and SUBSTR on the left of an assignment to change part of one. INDEX to find a string in another, VERIFY to check that a field holds only the characters it should, TRANSLATE to replace characters and TRIM to remove blanks. The date and time built-ins: DATETIME() as YYYYMMDDHHMISS999, DATE() and TIME(), and how a built-in with no arguments is written — with empty parentheses or declared BUILTIN.

LAB Program NAMES takes a padded full name apart with TRIM, INDEX and SUBSTR and prints LAST, FIRST: LOVELACE, ADA and the initials, checks a field with VERIFY, converts a date’s separators with TRANSLATE and prints today’s run date from DATETIME(). GO RC 0. Session 9 checkpoint (PL09).

4 videos · ~23 min
  1. 9.1 SUBSTR, LENGTH and || 6 min
  2. 9.2 INDEX, VERIFY, TRANSLATE and TRIM 6 min
  3. 9.3 DATE, DATETIME and TIME 5 min
  4. 9.4 Lab: Take a Name Apart 6 min

Procedures, arguments, RETURNS and %INCLUDE

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. Internal procedures and CALL, placed after the main line and skipped by it. Arguments passed by reference, so a procedure can change the caller’s variable — and the dummy argument PL/I passes instead when the attributes do not match, which silently loses the change. Functions with RETURNS and RETURN(expression), used inside expressions. Then %INCLUDE: shared declarations kept as members of your own library, found through the PLI step’s SYSLIB DD and listed in place in the compiler listing — PL/I’s copybooks.

LAB Program PAYCALC takes its rates from your include member RATES, computes net pay with a function that RETURNS a decimal and adds a bonus through a procedure that changes its argument: GROSS 1000.00 NET 780.00, BONUS 50.00, RC 0. Session 10 checkpoint (PL10).

5 videos · ~31 min
  1. 10.1 Internal Procedures and CALL 6 min
  2. 10.2 Arguments and Parameters 6 min
  3. 10.3 Functions with RETURNS 6 min
  4. 10.4 %INCLUDE and a Library of Shared Declarations 7 min
  5. 10.5 Lab: A Pay Calculator with a Shared Member 6 min

Record I/O with files, JCL and DD

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Five videos. Record I/O moves whole records unchanged: DECLARE file FILE RECORD INPUT, whose name is the DD name the GO step supplies, OPEN and CLOSE — and what UNDEFINEDFILE means when the DD is missing. READ … INTO and ON ENDFILE, and the read loop every batch program uses: read once before the loop, process, read again at the bottom. A record layout as a structure laid over the 80 bytes, its amount converted from text. WRITE … FROM and the output DD: to the spool, or to a new cataloged data set with its DCB.

LAB Program FILTER reads five sales records from in-stream data into a structure, writes the ones over 50.00 unchanged to an output file and prints RECORDS READ 5 WRITTEN 2; the output file holds exactly the two big sales. Session 11 checkpoint (PL11).

5 videos · ~31 min
  1. 11.1 Files: DECLARE FILE, the DD Name, OPEN and CLOSE 6 min
  2. 11.2 READ INTO and ON ENDFILE: The Read Loop 6 min
  3. 11.3 A Record Layout as a Structure 6 min
  4. 11.4 WRITE FROM and the Output DD 6 min
  5. 11.5 Lab: Filter the Big Sales 7 min

Conditions and ON-units: reading an error

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. A condition is an event PL/I watches for — ENDFILE, CONVERSION, ZERODIVIDE, UNDEFINEDFILE, ERROR — and an ON-unit says what to do when it happens; ONCODE says what happened, SIGNAL raises a condition to test the on-unit and REVERT cancels it. An unhandled condition read from its evidence: the IBM message with the ONCODE and the condition’s name in SYSPRINT, and the step’s abend U4038. Then recovery: a CONVERSION on-unit that reports the bad text with ONSOURCE, corrects it and lets the program count the record instead of dying, and what ON ERROR can and cannot do.

LAB Program SAFESUM reads five sales with one bad amount, reports BAD AMOUNT [ 3.O0] IN EAST from its CONVERSION on-unit, totals the four good ones to 257.49 and ends RC 4 — finished, with a warning. Session 12 checkpoint (PL12).

4 videos · ~26 min
  1. 12.1 What a Condition Is: ON, ONCODE, SIGNAL and REVERT 6 min
  2. 12.2 An Unhandled Condition: Reading the Message and the Abend 7 min
  3. 12.3 CONVERSION and ZERODIVIDE: Recover and Count 7 min
  4. 12.4 Lab: Survive a Bad Record 6 min

Final project: the branch sales report

Coming soon The videos for this session are being produced; its lessons and lab are published here now.

Four videos. One complete program of the kind PL/I batch is made of, built the way real programs are: source and include members in your libraries, your own cataloged procedure PLICL that compiles and binds into your load library (IBM ships IBMZC, IBMZCB and IBMZCBG for the same job), and a run step that executes the program with STEPLIB. The report: a heading with the run date, one line per sale, a total line at every change of branch — a control break — a grand total, and a check against the control record at the end of the file: RC 0 when it agrees, RC 8 and a warning when it does not. Built in stages and run at every stage. The course closes with an honest map of what comes next.

LAB Capstone (PL13): program SALESRPT, compiled and bound with your PLICL procedure and run from your load library, prints the branch totals NORTH 87.50, SOUTH 123.00 and WEST 249.99, GRAND TOTAL 460.49, RECORDS 6 and CONTROL TOTAL AGREES, and ends RC 0.

4 videos · ~28 min
  1. 13.1 The Job to Be Done, and Your Own Procedure 7 min
  2. 13.2 Build It in Stages 8 min
  3. 13.3 Control Break, Totals and the Return Code 7 min
  4. 13.4 Capstone, and Where Next 6 min
//SKILLS  DD DSN=AFTER.THIS.COURSE

After this course, you can

//CERT    DD DSN=CS175.CERTIFICATE,DISP=(NEW,CATLG)

How the certificate is earned

CobolStack Certificate of Completion — PL/I for z/OS (CS175) is issued from the lab harness’s own record of your runs — not from attendance. To earn it you must clear every gate below:

The certificate attests that you can read, write, compile, bind, run and debug complete batch PL/I programs on z/OS — declarations of every basic type, exact decimal arithmetic, stream and record I/O, structures and arrays, procedures with %INCLUDE, ON-units and a control-break report — and read the unhandled condition that ended one: the PL/I literacy an estate needs to maintain, convert or replace what it runs.

The environment

Your seat is a private, full z/OS-compatible environment with an Enterprise PL/I-style compiler (IBMZPLI) and %INCLUDE, the binder, the PL/I run time with stream and record I/O and ON-conditions, the compile–bind–run job, listings, return codes and abend codes in the browser — nothing to install, snapshot and reset per exercise. By the end of the course the lab harness will have verified: thirteen programs of your own compiled, bound and run — a first message, a program from a blank member, every basic data type shown, an invoice line, three compile errors fixed, a formatted line from input, a classifier loop, a sales table with a based overlay, a name taken apart with the string built-ins, a pay calculator with a shared include member, a record filter, a program that survives a bad record, and a branch sales report with a control break and a control total, built with your own cataloged procedure at RC 0.