COMTRAN Reconstruction

The language reference is this project’s reading of the two manuals, not IBM’s text. Every claim in it cites a page, and each citation opens that page beside its scan.

Part 9 of 10 of the COMTRAN Language Definition.

9. Sample-program observations that illuminate the language

Citation note: this section sometimes pinpoints sub-items with the manuals' internal letter-coded structure (e.g. J 02.02.B.1.b = section 02.02, heading B, item 1.b); the leading numeric part is always the page-marker section code of the "(J xx.xx.xx)" convention.

Both manuals close with the same simplified payroll application, and the pair is the single best window into COMTRAN as actually written. F28-8043 Appendix 1 gives the 1960 version: a process chart, a flow chart, ten pages of hand-completed coding forms, and a typeset "machine listing" of the identical text (F pp. 87–104). J28-6169 Appendix 90.05 gives the 1962 version: prose describing the files, then the actual printer listing of a real compilation (dated 10/18/61, ID "CT PUBLICATIONS") ending "NO ERRORS WERE DETECTED DURING COMPILATION", plus loader cards, an object listing, and the run's report output (J 90.05.00–90.05.04; J 90.05 listing, PDF pp. 192–217). The J version is "essentially the example described in the Commercial Translator General Information Manual", modified in "two types … those which were necessary for operation on the 7090, and those which improved the organization and efficiency of the problem" (J 90.05.01). Every difference between the two versions is therefore diagnostic: it shows either a language change between 1960 and 1962 or an implementation-driven idiom. This section records what the samples demonstrate, not what they compute.

The observations below cite the F sample by printed page and the J sample by prose section code (J 90.05.0x) or, for the listing pages that carry no section code, by PDF page ("J 90.05 listing, PDF p.19x").

9.1 Program-level structure as practiced

9.2 Coding-form usage in practice

9.3 Data description in practice

9.3.1 Level structure and layout

9.3.2 Type codes and pictorials actually exercised

Feature F sample J sample Rule / note
Numeric external 99, 9999, 99V999, 9(5)V99, 9(6) 99V9 (DETAIL HOURS), 9V99 (TABLE.ITEM INSPREM, RETPREM, st. 171–172) J types the detail-record fields alphameric except HOURS: "HOURS is the only field … specified as numeric", a rationale scoped to the DETAIL records (J 90.05.02)
Alphameric A, AAA, A(15) AA, AAAA, A(6), A(15), A(18), A(23), A(30) fields F typed 99 (DEPARTMENT, MONTH…) are AA in J; see 9.5.3 (HIGH.VALUE)
Internal mode none written IR99V999, IR9(4)V99, IR99 … mode+justify written as prefix letters of the pictorial, as in J 02.03.D's own example X 01 IR999
Edited $***9.99, 8889.9-, $8889.99-, $88889.99-, $88899.99- (non-exhaustive) $8889.99, 8889.99, 8889.9, 88889.99, 899V99 (non-exhaustive) 8 = zero-suppress digit, $ before 8s floats, * = check-protect fill, trailing - = sign position (F p. 80)
RCDMRK — ENDFRSTLINE 02RCDMRK A (listing st. 42) inserts a one-character record-mark constant; pictorial A supplied automatically (J 02.05.B.4)
COPY GRAND.TOTAL 1COPY DEPARTMENT.TOTAL (F pp. 99, 104) absent: GRAND.TOTALS written out field-by-field (listing st. 133–142) F/J divergence: "Implementation of COPY has been deferred" (J 90.01.03.b.i)
REDEF unnamed entry 1REDEF TABLE, then TABLE.ITEM 2 12 (F p. 100/104) bare line REDEF TABLE (compiler names it GN)057), then TABLE.ITEM 1 12 (listing st. 168–169) J's rule: the REDEF line carries "no additional coding except a serial number and the name of the item being redefined", and the first following item must have the same level as the redefined item (J 02.05.B.3.a): the F sample violates both halves; see Ambiguities
Constants (initial values) TABLE = one 132-char alphameric literal over 6 cards (F p. 100) per-field constants: A '1', A '-', A(30) ' ', A(21) ' DEPARTMENT ', IR9(5) '00999', '080060' … J 02.05.E.2; J 90.05.04: for blank constants, "If the format specification indicates the length of the field, it is unnecessary to provide the proper number of blanks between quote marks"

9.4 Environment description as actually written (J only)

The complete environment division is fourteen entries (J 90.05 listing, PDF p. 195, st. 173–186):

173,00           INPUTMASTER      FILE   INPUT,BINARY,TAPE,MASTER,BLOCKSIZE 300
174,00                            SPECIFINPUTMASTER, UNIT1 'D1',OPENW,CLOSER
...
181,00           PAYFILE          FILE   OUTPUT,BCD,TAPE,PAYRECORD,
                                           DEPARTMENT.TOTAL,BLOCKSIZE 20
182,00                            SPECIFPAYFILE, UNIT1 'D3',OPENW, CLOSER,LOW

9.5 Procedure idioms, verb by verb

9.5.1 CALL — and a real F/J semantic divergence

Both programs open with CALL as their first statement, defining abbreviations before any executable flow (F p. 91; J listing st. 187):

F:  CALL (EMPLOYEE.NUMBER) EMPLOYNO, ... (DEPARTMENT.TOTAL) DPT.
J:  CALL (MASTER EMPLOYEE.NUMBER) M.EMP.NO, (DETAIL EMPLOYEE.NUMBER) D.EMP.NO, ...

9.5.2 The GET/FILE matching loop

The balanced-line skeleton is identical in both versions (F pp. 91–92; J listing st. 190–198):

GET.MASTER.  GET MASTER, AT END DO END.OF.MASTERS.
GET.DETAIL.  GET DETAIL, AT END GO TO END.OF.DETAILS.
COMPARE.EMPLOYEE.NUMBERS.  GO TO CHECK.NEW.DEPT WHEN D.EMP.NO =
             M.EMP.NO,  LOW.DETAIL WHEN D.EMP.NO LT M.EMP.NO.
HIGH.DETAIL. ...

9.5.3 The HIGH.VALUE sentinel idiom — and the typing change it forced

Both versions equalize the merge with figurative sentinels (F p. 92; J listing st. 197–198):

END.OF.MASTERS.  IF D.EMP.NO = HIGH.VALUE THEN GO TO END.OF.RUN
                  OTHERWISE SET M.EMP.NO = HIGH.VALUE.

9.5.4 DO, sections, and control flow

9.5.5 Conditional sentences and relational spellings

The samples freely mix every documented spelling of the relations, all in ordinary IF … THEN … OTHERWISE sentences whose branches are comma-chained imperative clauses:

Spelling Sample instance
IS EQUAL TO / IS NOT EQUAL TO F p. 91; J st. 200, 205
= (in a condition) IF D.EMP.NO = HIGH.VALUE (J st. 197; F p. 92)
IS LESS THAN / IS GREATER THAN F pp. 91–93
LT / GT D.EMP.NO LT M.EMP.NO (J st. 192); IF MASTER RATE GT … (F p. 94; J st. 225)
IS NOT GREATER THAN / NOT GT F p. 94; IF MASTER BONDENOMINATION NOT GT M.BND.ACC (J st. 219)

An OTHERWISE branch may itself end in GO TO, and a THEN branch may carry several commands ending the sentence (… THEN SET …, SET MASTER FICA = 144.00., J st. 212).

9.5.6 SET, arithmetic, and the TR truth function

9.5.7 MOVE in practice

9.5.8 MOVE/ADD CORRESPONDING in practice — including the sharpest F/J rule divergence

9.6 What the compilation listing reveals about the source language

(Source-level observations only; for generated code see Appendix 90.02 material.)

9.7 What the execution output reveals

The run's reports (J 90.05 listing, PDF p. 217) close the loop on the editing rules of §3:

9.8 Consolidated F-sample vs J-sample divergence table

Topic F sample (1960) J sample (compiled 1961/62) Authority
Divisions present/order *PROCEDURE, *DATA; no environment *DATA, *ENVIRONMENT, *PROCEDURE J 90.05 listing; F p. 87
Serial sequence checking checked (F p. 37) not checked; sample deck prints none J 02.03.A.1
CALL old.name shared simple name; synonym later qualified must be unique (qualified old.name); synonym used unqualified J 02.04.05
Employee-number typing for HIGH.VALUE numeric 99/9999 alphameric AA/AAAA J 02.04.01.b, 02.04.02
STOP STOP 1234 (serial 02011), and no STOP RUN STOP RUN, and no STOP n. J keeps STOP n: the computer stops, and the START key resumes the object program. J requires a STOP RUN in each program, and msg 175,00 reports its absence. The sample replaced the one form with the other; J withdraws neither. J 05.06.04 a; J 02.04.06 #9; J 90.04.01 msg 175
COPY type code GRAND.TOTAL 1COPY DEPARTMENT.TOTAL not used; COPY deferred J 90.01.03.b.i
REDEF coding level-1 unnamed 1REDEF TABLE; TABLE.ITEM level 2 bare REDEF TABLE (GN-named); TABLE.ITEM level 1 = level of TABLE J 02.05.B.3.a
Table initialization six unnamed level-2 entries, each a 22-character alphameric literal with its own quote marks, no continuation; the form (p. 100) and the machine listing (p. 104) agree 24 per-field constants, internal + external, no continuations F pp. 100, 104; J 02.03.D (internal arithmetic)
CORRESPONDING reliance name-only matching assumed (… TO PAYRECORD, CURRENT) qualifier-chain rule respected; explicit MOVEs where chains differ J 02.04.04
Arithmetic staging in record fields (external) in WORKING (IR fields) J 02.03.D
Master numeric typing bare pictorials, so external decimal: RATE 99V999, EXEMPTIONS 99, the TOTALS fields 99999V99 and 999V99, FICA 999V99, WHT 9999V99, and the bond fields 99V99 and 999V99 (serials 05009–05023). The program declares no file, because it has no environment division. the same fields carry the IR mode code: IR99V999, IR99, IR9(4)V99 and IR999V99, IR999V99, IR9(4)V99, IR99V99 and IR999V99. GROSS also narrows from five integer digits to four. INPUTMASTER and OUTPUTMASTER are BINARY files. The date fields MONTH, DAY and YEAR do not become internal; they become alphameric AA. F p. 103; J 90.05
Error output error code inside master/detail records, FILE … IN ERROR.FILE dedicated ERROROUT record, plain FILE J 02.07.08
WHT zero-floor IF/OTHERWISE SET … = ZEROS * TR(WORKING WHT GT 0) F pp. 24, 106
Subscript use in search INDEX for all three arrays INDEX for probe, copied to POS for fetches J 90.01.02; J 02.04.D
FICA cap tests, then adds: IF MASTER FICA + 0.03 * DETAIL GROSS IS LESS THAN 144.00 THEN SET DETAIL FICA = 0.03 * DETAIL GROSS OTHERWISE SET DETAIL FICA = 144.00 - MASTER FICA (serials 03016–03018) adds, then caps: ADD WORKING FICA TO MASTER FICA. IF MASTER FICA GT 144.00 THEN SET WORKING FICA = WORKING FICA - (MASTER FICA - 144.00), SET MASTER FICA = 144.00 F p. 93; J 90.05 listing
Overtime pay two sentences. IF DETAIL HOURS IS GREATER THAN 40 THEN SET DETAIL GROSS = (DETAIL HOURS - 40) * MASTER RATE * 1.5 (serials 02012–02013), then the unconditional SET DETAIL GROSS = DETAIL GROSS + MASTER RATE * 40 (serial 02014). Below 40 hours the first sentence does not fire, so the second sentence adds 40 hours of pay to the detail record's own GROSS field. one sentence with two arms: IF WORKING HOURS GT 40.0 THEN SET WORKING GROSS = (WORKING HOURS * 1.5 -20) * MASTER RATE OTHERWISE SET WORKING GROSS = WORKING HOURS * MASTER RATE (statement 203,00). Above 40 hours the two programs compute the same value. Below 40 hours they do not: the J sample pays the hours worked. F p. 101; J 90.05 listing
Bond orders filed into the error file: FILE BONDORDER IN ERROR.FILE (serial 04014) filed into its own BONDORDERFILE: FILE BONDORDER F p. 94; J 90.05
The updated master the introduction promises an updated master file as output; the program files MASTER only in error every matched master is filed to OUTPUTMASTER: FILE MASTER F pp. 87, 91, 93; J 90.05
The last department's totals department totals print on a department change only, so the last department's never print; END.OF.RUN moves GRAND.TOTAL straight to PAYRECORD (serials 02009–02010, 03005–03010) END.OF.RUN does DEPARTMENT.END first F pp. 92–93; J 90.05
INDEX and the department key INDEX declared 99 inside the RECORD CURRENT, DEPARTMENT beside it (serials 10013–10015) INDEX and POS are IR99 in WORKING; CURRENT.DEPT is AA in DEPARTMENT.TOTAL F p. 100; J 90.05

9.9 Flagged ambiguities (details in §8.5)

  1. Statement-number placement at listing statements 217–221 vs the per-sentence numbering rule (J 02.02.B.1.b vs B.2). Resolved 2026-08-03: no conflict; the transcription's half-line stagger created it. See §8.5.7-m.
  2. F's name-only CORRESPONDING vs J's qualifier-chain rule; F sample moves that match nothing under J semantics.
  3. F's CALL of a non-unique old.name with later-qualified synonyms vs J's uniqueness rule; J is silent on whether a synonym may be qualified at all.
  4. MOVE BLANKS into edited/external fields is starred "doubtful" in J's chart yet compiles with no errors in the sample.
  5. *COMPILE LIST on the sample listing vs the documented $CMPLE control card.
  6. REDEF coding convention (F's leveled, named-line REDEF vs J's bare line + same-level first item).
  7. GO TO exits from DO'd procedures vs the closed-subroutine doctrine.
  8. The PAYFILE short-record/BEGIN boundary rule quoted in J 90.05.04 has no stated general form.