Learn it on Mainframe Path. Do it with Mainframe KIT.Learn on Mainframe Path ▸
Mainframe KIT ● Nothing leaves this tab

COBOL debugger

Step through a COBOL program line by line and watch every field change.Use this when you want to see why a COBOL program or Db2 stored procedure gives a wrong result or an S0C7, one statement at a time.

Simulation, confirm on z/OSON THIS DEVICE · NOTHING UPLOADEDCounting requests…
How to use this tool

What it does

Runs a COBOL program you paste one statement at a time, and shows every field change, including packed bytes.

How to use it

  1. Paste a COBOL program, or press Example.
  2. Press Start, then Step for one statement or Run to a breakpoint.
  3. Watch every field change, including packed bytes.

What it cannot do

  • It simulates the program; it is not a compiler and does not run Db2 or CICS.
  • Some statements stop the run with a message.
  • Compiler and run-time options of your site can change results.

PROGRAM · paste the source
F8=StepF7=OverF9=Runon this device

What this page remembers

To save you retyping, this page keeps your program, input data, COPY members and settings in this browser on this device (never sent anywhere). On a shared computer, clear them when you finish.

Input data and COPY members

Input files and SYSIN appear here when the program reads them.

One record per line. A line written as X'C1C2…' gives exact bytes, for packed fields. Each COPY member gets its own box; the listing then shows the program with the member expanded (lines marked C), as a compiler listing does.

Called programs

A CALL 'NAME' (or CALL identifier, using the identifier's value) runs the pasted program with that PROGRAM-ID. Arguments match the called program's USING by position: BY REFERENCE shares storage, BY CONTENT and BY VALUE pass a copy. A called program keeps its WORKING-STORAGE between calls until it is CANCELed (or if it is IS INITIAL); GOBACK and EXIT PROGRAM return, STOP RUN ends everything.

Start the program as if Db2 had called it: give each PROCEDURE DIVISION USING parameter a value, and type the rows each cursor should return. At the end you see the parameter values handed back and the result sets.

Runs fixed-format or free-format Enterprise COBOL: WORKING-STORAGE, LOCAL-STORAGE and LINKAGE, COPY members, CALL and CANCEL of programs you paste (USING BY REFERENCE, BY CONTENT, BY VALUE, OMITTED, RETURNING, ON EXCEPTION), sequential files (READ, WRITE, REWRITE), SORT of a file with an SD (USING, GIVING, INPUT and OUTPUT PROCEDURE with RELEASE and RETURN), MOVE and MOVE CORRESPONDING, COMPUTE, ADD … DIVIDE (and ADD / SUBTRACT CORRESPONDING), IF, EVALUATE, PERFORM (THRU, UNTIL, VARYING), GO TO, SEARCH, INSPECT, STRING, UNSTRING, INITIALIZE (with FILLER, VALUE, REPLACING, DEFAULT), SET, DISPLAY and ACCEPT, with COMP-1 and COMP-2 floating point stored as IBM hexadecimal (plain MOVEs keep every bit, but arithmetic on COMP-2 keeps about 15 to 16 significant digits, a little less than z/OS). EXEC SQL and EXEC CICS stop and ask you for the result; in stored-procedure mode, OPEN, FETCH (including scrollable cursors) and CLOSE of a declared cursor use the rows you typed. Not supported yet, and stopped with a message: SORT of a table, MERGE, SORT with COLLATING SEQUENCE, recursive CALLs, CALL USING ADDRESS OF, and floating-point literals or numeric literals BY REFERENCE as CALL arguments (a numeric literal BY CONTENT is passed as a zoned DISPLAY item). Anything else is reported, never guessed.

READY · paste a program or load an example
●=Breakpoint▶=Next statement

Variables

Press START to see every field and its bytes.

OUTPUT · DISPLAY

    

What happened

    How close is it to z/OS? Field sizes, packed and zoned bytes, MOVE and editing rules follow IBM Enterprise COBOL. The S0C7 check follows what the hardware does in decimal arithmetic; whether a given program abends can still depend on compiler options such as NUMPROC. Fields without a VALUE start as X'00' here. Intermediate results are kept exact, so a final digit can differ where IBM's intermediate-precision rules round differently.

    ACCURACY · SIMULATION · CONFIRM ON Z/OS

    A simulation that follows Enterprise COBOL rules, checked by two independent reviews and tests. Results can depend on compiler options, and Db2 and CICS results are the ones you type in. Confirm on z/OS.

    What it checks

    • ConfirmedRuns fixed-format or free-format Enterprise COBOL one statement at a time, with breakpoints and a variable watch that shows packed-decimal bytes.
    • ConfirmedDetects invalid numeric data (S0C7) and shows the field and bytes responsible.
    • ConfirmedCALL, CANCEL, COPY members, sequential files, SORT of a file, floating point stored as IBM hexadecimal, and Db2 stored-procedure result sets, with the rules recorded in docs/FACTS.md.
    • Depends on your systemEXEC SQL and EXEC CICS stop and ask for the result; the rows and codes you type are used as given.

    What it does not check

    • UnsupportedSORT of a table, MERGE, SORT with COLLATING SEQUENCE and recursive CALLs stop with a message.
    • UnsupportedCALL USING ADDRESS OF, and floating-point literals or numeric literals BY REFERENCE as CALL arguments, stop with a message.
    • Depends on your systemCompiler options, run-time options and Language Environment settings of your site can change results.
    • Depends on your systemCOMP-2 arithmetic keeps about 15-16 significant digits, a little less than z/OS; plain MOVEs keep every bit.
    • Depends on your systemIt simulates a program; it is not a compiler and does not run Db2 or CICS. Confirm on z/OS.

    Source

    Simulation, confirm on z/OS. Status labels: Confirmed Depends on your system Unsupported (a rule with an official source; depends on your catalog, security, installation defaults or compiler options; not parsed and shown instead of guessing).

    Input limits and example

    • Program, copy members, called programs and inputs: 200,000 characters per box.
    • A run stops after 1,000,000 statements.

    EXAMPLE INPUT

           IDENTIFICATION DIVISION.
           PROGRAM-ID. DEMO.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01 N PIC 9(3) VALUE 5.
           PROCEDURE DIVISION.
               ADD 1 TO N.
               DISPLAY N.
               STOP RUN.

    Check it yourself in one minute

    1. Open your browser's developer tools: in Chrome or Edge press F12 or right-click and choose Inspect; in Firefox press Ctrl+Shift+E for the Network Monitor; in Safari first turn on Show features for web developers under Settings, Advanced. Then open the Network tab.
    2. Keep the log across page loads (Chrome: Preserve log; Firefox: Persist Logs), then use the tool: paste your text or open a file and press the button.
    3. Look at the list. You will see only this page and its own files, loaded when the page opened. Nothing new appears when you use the tool.
    4. Still unsure? Switch Wi-Fi off and try again. The tool still works.

    What the badge counts: requests the browser logged after this page finished loading, other than the site's own files. It reads the browser's own record and makes no request of its own. If your browser cannot give that record, the badge says so. The badge is a convenience; the developer tools are the proof.

    The rule that enforces it

    Every page carries this Content Security Policy. The browser itself refuses any request outside it; connect-src 'none' blocks fetch, XHR and WebSocket.

    default-src 'none';
    script-src 'self';
    style-src 'self';
    img-src 'self' data:;
    font-src 'self';
    connect-src 'none';
    object-src 'none';
    form-action 'none';
    base-uri 'none';
    manifest-src 'self';
    worker-src 'self'