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

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

REXX from Zero

REXX from zero to real execs on z/OS — no REXX and no other language needed. In plain English and in short sessions: clauses, strings and SAY, typeless variables, ARG and PULL, decimal arithmetic and NUMERIC DIGITS, IF, SELECT and DO loops, the string and date built-ins, compound variables, PARSE templates, procedures and functions with PROCEDURE EXPOSE, data sets read and written with EXECIO after ALLOCATE, TSO host commands and their RC, OUTTRAP, SIGNAL ON ERROR and SYNTAX, and TRACE. Thirteen sessions, thirteen execs, each one checked from your own job: by the last one your own report exec, run in batch from your own exec library, allocates a data set, totals it by branch, writes a report and checks a control total.

Self-paced available Cohort

Open for enrollment now. No REXX 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: CS160 REXX, CLIST & ISPF Dialogs picks up where this course ends — the data stack, ISPF panels and tables, edit macros and CLIST — and CS120 JCL & Batch covers the JCL every batch exec runs in.

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 REXX 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 REXX is — IBM’s interpreted scripting language for z/OS: no compile and no bind, one kind of data, and built-in functions for text — and where it runs: TSO and ISPF, batch jobs, the utilities and automation every shop builds. Then your first run, before any theory: a job with two steps — SAVE (IEBGENER copies your exec, typed in the job, into your own exec library) and RUN (IKJEFT01, TSO in batch, runs it as %HELLO) — and an exec whose only work is one SAY. You copy the job as it is; 2.4 takes it apart. Live on the system: the two step return codes, your line in the RUN step’s SYSTSPRT, and what happens to text you forget to put in quotes.

LAB Allocate your two libraries, type the job into your own JCL library, submit it, and find the two return codes and your line of output. Then change the text so that it contains your userid and run it again: SAVE and RUN both RC 0. Session 1 checkpoint (RX01), checked from your own job.

4 videos · ~21 min
  1. 1.1 What REXX Is 5 min
  2. 1.2 Where REXX Runs 5 min
  3. 1.3 Your First Run: Store and Run 6 min
  4. 1.4 Lab: Make It Yours 5 min

Clauses, strings, and where an exec runs

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

Five videos. An exec is a list of clauses: a semicolon ends one early, a comma continues one on the next line, and comments sit between /* and */. Instructions, assignments and commands — and why a clause that is only a string goes to TSO as a command. Strings in single or double quotes, and the three ways to join them: a blank, abuttal and ||. Running the exec your job stored, yourself, from ISPF option 6 with EX. The job line by line: IEBGENER with DD DATA,DLM=@@, IKJEFT01 with SYSEXEC, SYSTSPRT and SYSTSIN, and COND. And EXIT n: the number your exec hands back becomes the RUN step’s return code.

LAB From a blank member, write exec SHAPE — a comment, two clauses on one line, one SAY continued over two lines, and EXIT 7. The RUN step must end RC 7. Session 2 checkpoint (RX02).

5 videos · ~27 min
  1. 2.1 The Shape of an Exec: Clauses and Comments 5 min
  2. 2.2 Strings and Concatenation 6 min
  3. 2.3 Running an Exec from TSO: Option 6 and EX 5 min
  4. 2.4 The Job, Line by Line 6 min
  5. 2.5 Lab: EXIT and the Return Code 5 min

Variables, ARG and PULL

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

Four videos. Variables need no declaration and have no type: every value is a string, and a string that looks like a number can be computed with. A name that was never given a value is its own name in upper case — the cause of many a puzzling line of output — and DROP unsets it. ARG and PARSE ARG take the words that follow the exec’s name on the command line, upper-cased or as typed. PULL and PARSE PULL read the lines that follow the command in SYSTSIN — input data for a batch exec.

LAB Exec GREET is run as %GREET Ada Lovelace with a data line 3 4 after it: it says HELLO, Ada Lovelace from its arguments, reads the two numbers with PULL, says SUM 7 and ends RC 0 when the sum is right. Session 3 checkpoint (RX03).

4 videos · ~22 min
  1. 3.1 Variables and Typeless Data 6 min
  2. 3.2 ARG: Arguments from the Command 5 min
  3. 3.3 PULL: Input from SYSTSIN 5 min
  4. 3.4 Lab: A Greeting from Input 6 min

Arithmetic and NUMERIC DIGITS

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

Four videos. The operators + - * /, % (whole part), // (remainder) and **, and their order. REXX arithmetic is decimal, like a calculator: 0.1 + 0.2 is exactly 0.3 and 12 × 3.75 is 45.00. NUMERIC DIGITS decides how many significant digits a result keeps — 9 unless you say otherwise — and when a large result is written with an exponent. FORMAT rounds for printing, TRUNC cuts, DATATYPE checks that input is a number before you compute with it, and what a sum with a word in it does to your exec.

LAB Exec INVOICE multiplies a quantity by a price, rounds a 7.5% tax to the cent with FORMAT and adds it: NET 45.00, TAX 3.38, TOTAL 48.38, and RC 0 only when the total is right. Session 4 checkpoint (RX04).

4 videos · ~22 min
  1. 4.1 Operators and Precedence 5 min
  2. 4.2 NUMERIC DIGITS: How Many Digits a Result Keeps 6 min
  3. 4.3 Rounding, FORMAT and Bad Numbers 5 min
  4. 4.4 Lab: An Invoice Line 6 min

Decisions: IF, SELECT and comparisons

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 … END group when more than one clause belongs to the IF. Normal comparisons — numbers compared as numbers, strings with their outer blanks ignored — and strict ones (==), character for character. NOT is \ (or ^ and ¬), with & and | to combine. SELECT with WHEN and OTHERWISE, where the first true WHEN wins and the order matters.

LAB Exec GRADES walks seven scores word by word and classifies each with a SELECT: A 2, B 2, C 1, F 2, and RC 0 only when the counts are right. Session 5 checkpoint (RX05).

4 videos · ~22 min
  1. 5.1 IF, THEN, ELSE and DO … END 5 min
  2. 5.2 Comparisons: Normal and Strict 6 min
  3. 5.3 SELECT, WHEN and OTHERWISE 6 min
  4. 5.4 Lab: Grade the Scores 5 min

Loops: DO, WHILE, UNTIL, LEAVE and ITERATE

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

Four videos. DO n and DO i = 1 TO n BY k, and the value the control variable has after the loop. DO WHILE (tested first, may run zero times), DO UNTIL (tested last, runs at least once) and DO FOREVER with LEAVE. ITERATE to skip to the next pass, and what REXX says when a DO has no END.

LAB Exec 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 reaches 100 (128 in 7 steps), and ends RC 0 only when the counts are right. Session 6 checkpoint (RX06).

4 videos · ~22 min
  1. 6.1 Counted Loops: DO n and DO i = … TO … BY 5 min
  2. 6.2 DO WHILE, DO UNTIL and DO FOREVER 6 min
  3. 6.3 LEAVE and ITERATE 5 min
  4. 6.4 Lab: Count and Double 6 min

String built-in functions

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

Five videos. SUBSTR, LENGTH, LEFT, RIGHT and STRIP to cut, pad and clean strings. POS to find one string in another (the needle comes first), TRANSLATE to replace characters, VERIFY to check that a field holds only the characters it should, and COPIES, REVERSE and CENTER. Strings as lists of words: WORD, WORDS, SUBWORD and WORDPOS. And DATE and TIME in their formats, including converting a given date.

LAB Exec NAMES takes a padded full name apart with STRIP, POS and SUBSTR and says LAST, FIRST: LOVELACE, ADA and the initials, checks a field with VERIFY, converts a date’s separators with TRANSLATE and says today’s run date from DATE('S'). RC 0. Session 7 checkpoint (RX07).

5 videos · ~28 min
  1. 7.1 SUBSTR, LENGTH, LEFT, RIGHT and STRIP 6 min
  2. 7.2 POS, TRANSLATE, COPIES and Friends 6 min
  3. 7.3 Words: WORD, WORDS, SUBWORD and WORDPOS 5 min
  4. 7.4 DATE and TIME 5 min
  5. 7.5 Lab: Take a Name Apart 6 min

Compound variables and stems

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

Four videos. A name with a dot is a compound variable: sale.i is REXX’s array, and sale.0 holds the count by convention — the way EXECIO and OUTTRAP fill a stem. Assigning to the stem, count. = 0, initialises every element; a tail can be a name as well as a number, so count.branch is a table keyed by branch. DROP of a stem, and keeping the list of keys you have seen, because a stem cannot list its own tails.

LAB Exec TABLES keeps five sales in a stem, totals them per branch with the branch name as the tail and says ENTRIES 5 TOTAL 260.49 and each branch total, ending RC 0 when the branch totals add up. Session 8 checkpoint (RX08).

4 videos · ~22 min
  1. 8.1 Compound Variables: stem.i 6 min
  2. 8.2 Initialising a Stem, and Tails as Keys 6 min
  3. 8.3 DROP, and Keeping a List of Keys 4 min
  4. 8.4 Lab: A Sales Table 6 min

PARSE templates

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

Five videos. PARSE VAR splits a variable into words — the last variable takes the rest, and a period throws a word away. Literal patterns split at a character (a date at its dashes, key=value pairs); positional patterns split by column, the way fixed records are laid out. PARSE VALUE … WITH parses the result of any expression, PARSE UPPER upper-cases, and PARSE SOURCE tells an exec how it was run.

LAB Exec PARSES reads a heading line and four sales records from SYSTSIN with PARSE PULL, splits the date with literal patterns and each record with a positional template, and says DATE 15/11/2026, RECORDS 4 and TOTAL 211.00. RC 0. Session 9 checkpoint (RX09).

5 videos · ~28 min
  1. 9.1 PARSE VAR: Splitting by Words 6 min
  2. 9.2 Literal Patterns: Splitting at a Character 6 min
  3. 9.3 Positional Patterns: Splitting by Column 5 min
  4. 9.4 PARSE VALUE, PARSE UPPER and PARSE SOURCE 5 min
  5. 9.5 Lab: Parse the Sales Records 6 min

Procedures and functions

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

Five videos. Labels and CALL, RETURN and the special variable RESULT — and why the main line must EXIT before its routines. Functions that RETURN a value and are used inside expressions, with arguments separated by commas. PROCEDURE to give a routine its own variables and EXPOSE to share just the ones it needs. External routines: an exec in your library called as a function from another, the way shops share code.

LAB Exec PAYCALC computes net pay with a function under PROCEDURE EXPOSE and adds a bonus with a routine that changes a shared variable: GROSS 1000 NET 780.00, BONUS 50, RC 0. Session 10 checkpoint (RX10).

5 videos · ~28 min
  1. 10.1 Internal Subroutines: CALL, RETURN and RESULT 6 min
  2. 10.2 Functions: RETURN a Value 5 min
  3. 10.3 PROCEDURE and EXPOSE 6 min
  4. 10.4 External Routines: Your Library as a Function Library 5 min
  5. 10.5 Lab: A Pay Calculator 6 min

Data sets: EXECIO, ALLOCATE and FREE

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

Five videos. EXECIO * DISKR reads every record of a file into a stem, with the count in .0; EXECIO n DISKW writes a stem out; FINIS closes. The file can be a DD in the job, or one your exec allocates itself with the TSO command ALLOCATE — an existing data set SHR, or a new one with its space and record format — and releases with FREE. RC after every command, and the shape of every read–process–write exec.

LAB Exec FILTER reads five sales records with EXECIO, parses each one, writes the ones over 50.00 unchanged to an output file with EXECIO DISKW and says RECORDS READ 5 WRITTEN 2; the output file holds exactly the two big sales. Session 11 checkpoint (RX11).

5 videos · ~29 min
  1. 11.1 EXECIO DISKR: Read a Data Set into a Stem 6 min
  2. 11.2 EXECIO DISKW: Write a Stem to a Data Set 5 min
  3. 11.3 ALLOCATE and FREE from REXX 6 min
  4. 11.4 A Read–Process–Write Exec 6 min
  5. 11.5 Lab: Filter the Big Sales 6 min

Host commands, RC and error handling

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

Five videos. ADDRESS TSO and the special variable RC after every command; LISTDS and SYSDSN to ask whether a data set exists. OUTTRAP to capture what a command prints into a stem and parse it. SIGNAL ON ERROR, SYNTAX and NOVALUE, and CALL ON ERROR, with SIGL, CONDITION and ERRORTEXT to say what went wrong and where. TRACE to watch an exec run, clause by clause.

LAB Exec CHECKDS checks four data set names under CALL ON ERROR, says FOUND 3 MISSING 1 and the name that is missing, and ends RC 4 — finished, with a warning. Session 12 checkpoint (RX12).

5 videos · ~28 min
  1. 12.1 ADDRESS TSO and RC 5 min
  2. 12.2 OUTTRAP: Capturing a Command's Output 6 min
  3. 12.3 SIGNAL ON ERROR and SYNTAX 6 min
  4. 12.4 TRACE: Watching an Exec Run 5 min
  5. 12.5 Lab: A Safe Data Set Checker 6 min

Batch REXX and the final project

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

Four videos. IKJEFT01 and IRXJCL compared: TSO commands or none, SYSTSIN or PARM, and the exec’s EXIT value as the step’s return code in both. A one-step job that runs an exec straight from your own library, edited in ISPF. Then one complete exec of the kind shops keep: it checks its input exists, allocates and reads it, totals it by branch in a stem, writes a report data set with a heading, the branch totals and a grand total, and checks a control total in the last record — RC 0 when it agrees, RC 8 when it does not — with every host command checked. Built in stages and run at every stage. The course closes with an honest map of what comes next.

LAB Capstone (RX13): exec SALESRPT, run from your own exec library by the one-step job RUNRPT, reads your sales data set, writes your report data set and says 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 · ~24 min
  1. 13.1 Batch REXX: IKJEFT01, IRXJCL and Your Own Library 6 min
  2. 13.2 The Project: a Branch Sales Report 6 min
  3. 13.3 The Report Data Set, the Control Total and the Return Code 6 min
  4. 13.4 Capstone, and Where Next 6 min
//SKILLS  DD DSN=AFTER.THIS.COURSE

After this course, you can

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

How the certificate is earned

CobolStack Certificate of Completion — REXX from Zero (CS155) 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, run and debug complete TSO/E REXX execs on z/OS — variables and decimal arithmetic, decisions and loops, the string built-ins, stems, PARSE templates, procedures and functions, data sets with EXECIO and ALLOCATE, TSO commands with their return codes, error traps and TRACE — and run them in batch: the REXX literacy a shop needs to maintain its own automation and the utilities around its estate.

The environment

Your seat is a private, full z/OS-compatible environment with TSO/E REXX in batch (IKJEFT01 and IRXJCL) and in the ISPF command shell, TSO commands (ALLOCATE, FREE, LISTDS, LISTCAT), EXECIO, OUTTRAP, SYSDSN and LISTDSI, the spool, and return 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 execs of your own stored and run in batch — a first line, an exec from a blank member that sets its return code, a greeting from arguments and input, an invoice line, a grade counter, a loop counter, a name taken apart with the string built-ins, a sales table in stems, sales records parsed by column, a pay calculator with functions, a data set filter with EXECIO, a data set checker that traps its errors, and a branch sales report that writes its own report data set and checks a control total, at RC 0.