Tooluck logoTooluck
SKILL.md

gnucobol-mainframe-batch

Agent skill frombenchflow-ai/skillsbench

GnuCOBOL toolchain pointers for mainframe-style batch programs (LINE/RECORD SEQUENTIAL files, PIC clauses, cobc build flags).

How to install gnucobol-mainframe-batch

install gnucobol-mainframe-batch
# install the skillsbench pack with the skills CLI
npx skills add benchflow-ai/skillsbench

# or add only this skill to Claude Code: copy the folder

tasks-extra/cobol-gl-batch-reconcile/environment/skills/gnucobol-mainframe-batch/

# into

~/.claude/skills/gnucobol-mainframe-batch/ (all projects)

.claude/skills/gnucobol-mainframe-batch/ (one project)

tasks-extra/cobol-gl-batch-reconcile/environment/skills/gnucobol-mainframe-batch/SKILL.md

Apache-2.0Full file
1# GnuCOBOL mainframe batch
2
3## Compile and run
4
5```bash
6cobc -x -free -o prog PROG.cbl
7./prog
8```
9
10`-free` allows `*>` comments and free-form source. File names in `SELECT`
11are resolved relative to the program's run directory.
12
13```cobol
14SELECT DETAIL-FILE ASSIGN TO "TRAN.DAT"
15 ORGANIZATION IS SEQUENTIAL.
16```
17
18For 80-byte fixed-record tapes use `ORGANIZATION IS SEQUENTIAL` with
19`RECORD CONTAINS 80 CHARACTERS` in the FD. Pad `WRITE` records to the
20required length (e.g. `MOVE SPACES TO BAL-REC` before populating fields).
21
22## PIC and signed amounts
23
24When a tape stores sign and magnitude in separate positions (`PIC X` plus
25`PIC 9(11)V99`), build a signed working-storage value before `ADD` /
26`SUBTRACT`. Using only the unsigned magnitude in `EVALUATE` branches is a
27frequent bug when debits and credits share the same magnitude field.
28
29`COMPUTE … ROUNDED` rounds half away from zero in GnuCOBOL (matches the
30Python `Decimal` `ROUND_HALF_UP` behaviour). Use it when multiplying a
31two-decimal amount by a four-decimal rate and storing into a two-decimal
32field.
33
34## Debug loop
35
361. `cobc -x -free -Wall -o prog PROG.cbl`
372. `DISPLAY` intermediate values for one or two records to confirm the
38 posting math and any cross-file lookups.
393. Reconcile against a short script that applies the task's posting rules
40 to the same tape layout.
41
42## References
43
44- [GnuCOBOL programmer's guide](https://gnucobol.sourceforge.io/doc/gnucobol.html)
45…

Excerpt shown under the repository's Apache-2.0 license.

More skills in skillsbench

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates