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
- Division order is flexible; F even omits a division. The F sample is written
*PROCEDUREfirst, then*DATA, "the actual procedure statements … in this case are written before the data description entries" (F p. 87), and contains no environment description at all, even though its procedure FILEs records "IN ERROR.FILE", a file that is never defined anywhere (F p. 91). The J sample deck is ordered*DATA,*ENVIRONMENT,*PROCEDURE(J 90.05 listing, PDF pp. 192, 195). A compiler writer should not assume a fixed division order from either sample alone. - Design artifacts precede code. F presents the methodology as flow chart + process chart ("how data should be grouped for input … and what data groupings are to be obtained") before the source program (F p. 87). This is doctrine, not language, but it explains the record-per-report-line data-description style seen in both samples.
- Deck framing (J only): the source deck is preceded by a control card echoed at the top of the listing as
*COMPILE LISTfollowed by the on-line phase lettersCTC, withCTDandCTEprinted at the end (J 90.05 listing, PDF pp. 192, 197). The phase letters are compiler progress markers, not source (J 05, "The letters CTC are printed on-line when this phase is entered"). Note the control card discrepancy against the documented$CMPLEcard (J 02.01.01); see Ambiguities.
9.2 Coding-form usage in practice
- Serialization encodes page + line. F's machine listing shows serials of the form ppnnn: procedure pages carry 01001–04022, data pages 05001–10015 (F pp. 101–104), matching the form's rule that the first three columns of the Ctl./Serial field (cols. 1–6) "is the same for all lines on one page" and that the low-order column is left for inserts (F p. 37). Serial 07006 is skipped between the BONDORDER and CHECK records on both the form and the listing (F pp. 97, 104): gaps for insertion are normal practice.
- F/J divergence: sequence checking. F: serials "will be sequence-checked by the processor" (F p. 37). J: "Card serial numbers in columns 1-6 of source decks are not sequence checked by the compiler" (J 02.03.A.1). Consistently, the J compilation listing prints no card serial column at all for this deck: only the compiler-assigned statement number and a location field (J 90.05 listing, PDF p. 192; cf. J 02.02.B.1, which reserves a first column for "source program card sequence numbers").
- Procedure-name margin. Labels sit in cols. 7–12 and "stick out" into the margin, extending into the text area when longer than six characters (F p. 37). In the F sample, long labels are written alone on a line with the sentence starting on the next line (
COMPARE.EMPLOYEE.NUMBERS.,WITHOLDING.TAX.ROUTINE.,BOND.CALCULATION., F pp. 91, 94), which strains F's own rule 1 that "a named sentence follows its name … on the same line as its name" (F p. 37). The J listing always re-joins label and sentence on one print line (J 90.05 listing, PDF p. 195). A parser must accept the label-on-its-own-line layout. - Continuation. Data/environment entries continue via a non-blank column 72; the F machine listing actually shows the mark: serial 09008/09009 splits the data-name
RETIREMENT./PREMacross two cards withXprinted in the CONT column (F p. 104; rule at J 02.03.A.2.a–b, including the rule that name-field blanks are squeezed out when rejoining). Procedure text needs no continuation character (J 02.03.A.2.a); every sample sentence simply flows across lines. - Literal continuation. The F TABLE's initial value is a single 132-character literal carried across six cards, with opening/closing quote marks repeated on each line (F p. 100 and its facsimile note). J 02.03.A.2.c pointedly notes that literals "continued on multiple lines in violation of the rules given on page 83 of the General Information Manual are handled correctly" by the 7090 processor but that this leniency should not be relied on for compatibility.
- Statement termination. Procedure sentences end with period-blank; anything after it on the card is commentary (J 02.03.A.3.a, J 90.01.03 A.1.a.ix). Data and environment entries must not use a period: "a period is considered part of the previous word, thus creating an undefined name" (J 02.03.A.3.b; also J 02.06.02). The samples obey this exactly: every J environment entry is period-free while every procedure sentence is period-terminated (J 90.05 listing, PDF p. 195).
- Spelling is verbatim. The section name
WITHOLDING.TAX.ROUTINE(single H) is spelled that way on the F form, in the F machine listing, and by the J compiler's echo (F p. 94; J 90.05 listing, PDF p. 196): names are arbitrary strings; nothing normalizes them.
9.3 Data description in practice
9.3.1 Level structure and layout
- Hierarchies run 1–4 levels deep in both samples (limit: 23 levels, J 90.01.05.j). The J listing echoes the programmer's leading-zero style inconsistently within one deck (MASTER's fields use
1/2/3/4, DETAIL's use01/02/03(J 90.05 listing, PDF p. 192)), consistent with "leading zeros are optional" (J 02.05.A.1). Indentation of names on the forms and listing is cosmetic; only the level number governs (e.g. level-2NETPAYat the margin, level-2WHTindented, F p. 98). - RECORD type marks only filed records. In J, MASTER, DETAIL, CHECK, PAYRECORD, DEPARTMENT.TOTAL, BONDORDER, ERROROUT are
RECORD; the working areas WORKING, INTERNAL.TOTALS, GRAND.TOTALS, and TABLE are plain level-1 hierarchies with no type code (J 90.05 listing, PDF pp. 192–194). F likewise leaves TABLE without RECORD but marks CURRENT as a RECORD though it is never filed (F p. 100). - Justification. In the J listing only the MASTER record prints an
Lin the MJ column; the other six RECORD entries carry no mark and rely on the default that fields of the highest level are left justified unless specified otherwise (J 90.05 listing, PDF pp. 192–194; default rule J 02.05.01). The F form's hand tick under JUSTIFY (transcribed[JUSTIFY: <], F p. 95) corresponds toLin F's machine listing, which prints it for every record except CURRENT (F pp. 103–104). Arithmetic fields are internal right-justified: "right justification is specified for increased operating efficiency" (J 90.05.01; rule at J 02.05.D.2). - Storage model made concrete. J 90.05.01–90.05.02 spells out the model the descriptions imply: the six-bit character is the smallest describable/addressable unit ("Individual bits may not be described or referenced"); the 9's of an internal field tell the processor the largest magnitude and "the number of words (when R is specified) or the number of characters (when L or no justification is specified)"; MASTER occupies exactly words 1–15 with NAME's odd 15 characters padded by the 3-character field TRIGGERS; DETAIL's word 3 holds HOURS "in the first three characters; 3 blanks (supplied automatically)" (J 90.05.02). F achieves the same word alignment with unnamed filler fields (a nameless level-2
AAAat the end of MASTER andAAAAAat the end of DETAIL (F pp. 95–96)), where J prefers a named field (TRIGGERS) or automatic padding. Both filler idioms must be supported. See §3 (Data description and storage model).
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" |
- The TABLE rewrite is a lesson in modes. F initializes the whole rate table as one alphameric literal and redefines it into twelve 11-character
TABLE.ITEMs of99V999/9V99/9V99(F p. 100). J instead writes twenty-four constants (for each entry an internalIR9(5)rate constant plus one 6-character external constant packing both premiums), then redefines toTABLE.ITEM … RATE IR99V999, INSPREM 9V99, RETPREM 9V99(J 90.05 listing, PDF pp. 193–195, st. 143–172). The reason is doctrinal: "Arithmetic operations are performed only in the internal (binary) mode" (J 02.03.D), and the searched key RATE must compare against internal MASTER RATE. - Print records are described character-by-character. The J CHECK record is a two-print-line image: carriage-control constant
'1', date with'-'constants between MONTH/DAY/YEAR, a RCDMRK separating the lines, second-line control constant'2', NAME, and edited AMOUNT (J 90.05.03–90.05.04; listing st. 32–46). DEPARTMENT.TOTAL likewise embeds its own report wording as constants (' DEPARTMENT ',' TOTALS ') around the live fields (listing st. 79–99). PAYRECORD interleaves one-, two- and three-blank constant fields between every column (listing st. 48–78); F does the same with unnamedAfields (F p. 98). Report formatting in COMTRAN lives in the data description, not in the procedure. - State inside an output record. J keeps the "current department" comparand as
CURRENT.DEPT, a live field inside the DEPARTMENT.TOTAL print record (listing st. 81), tested byIF CURRENT.DEPT IS NOT EQUAL TO D.DEPT(st. 200). F kept an equivalent separate record CURRENT with fields DEPARTMENT and INDEX (F p. 100). - Name reuse and near-collision management. The same simple names (DATE, MONTH, DAY, YEAR, GROSS, NAME, EMPLOYEE.NUMBER, …) recur across records and are disambiguated by left-qualification (
MASTER DATE,DETAIL EMPLOYNO; rules F pp. 15–16). Where the J programmer wanted a field excluded from CORRESPONDING traffic or from qualification requirements he chose a different name: PAYRECORD'sHRS,INS.PREM,RET.PREM(listing st. 62, 72, 74) against WORKINGHOURSand TABLE.ITEMINSPREM/RETPREM. J's MASTER also holds both a groupDAT(EMPLOYEE.NUMBER + NAME, used whole for error reporting:MOVE MASTER DAT TO ERROROUT INFO, st. 193) and a fieldDATE(three letters versus four); the conversion notes confirmDATis genuinely the source name (J 90.05 listing, PDF pp. 192, 195). Sample names freely use imbedded periods (D.EMP.NO,INTERNAL.TOTALS): a period-containing name is still one "simple" name (F p. 15). - None of the sample's data names collide with reserved words (list at F p. 110; key-word classes at J 02.03.B), including apparently risky choices like DATA (an F group name, F p. 95), CHECK, TABLE, INDEX, DATE, and AMOUNT. The reserved list is small and the samples exploit that; only the always-key words (FILE, RECORD, BEGIN, FOR, IN, ON, WHEN, ZERO(S), HIGH.VALUE(S), LOW.VALUE(S) — J 02.03.B.1) are truly untouchable.
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
- Option order is looser than the general form. The published FILE-card form places
,BLOCKSIZE nnbefore,record.name.1(J 02.06.03); every sample FILE card writes it after the record names. The stated ordering constraint is only that per-record options follow their record name (J 02.06.04.a): the sample is the proof that file-level options may trail. - Fixed columns show through the listing. The FILE/SPECIF type code occupies cols. 25–30 and the description begins at col. 31, so
SPECIFabuts the file name (SPECIFINPUTMASTER); the file.name "must be the first item of the SPECIF card description field" (J 02.06.D.1). FILE entries carry their name in the Name field (cols. 7–22); SPECIF entries carry none. - One record, two files. MASTER is named on both INPUTMASTER and OUTPUTMASTER FILE cards; procedure-division
FILE MASTER(st. 208) then files it into the output file it is associated with (J 02.07.07.D.1.a); the master is updated in place in the input buffer (locate mode, no HOLD/SPANS specified; J 02.07.02–03) and rewritten. "Twenty 15-word records are grouped to form 300-word blocks … each record complete within a block, since it is desired to process input records in the buffer area, in the locate mode" (J 90.05.02). - BLOCKSIZE as an input truncator. DETAILFILE's tape blocks are physically 14 words, but
BLOCKSIZE 3reads only the 3-word record: "Alternatively, BEGIN and BLOCKSIZE 14 might have been specified … which would have enabled correct processing but allowed the full 14-word block to enter core" (J 90.05.03; BLOCKSIZE = "maximum number of words to be input from an input block", J 02.06.04.b). - Multi-record output file. PAYFILE names two record types (PAYRECORD, DEPARTMENT.TOTAL) on one FILE card continued onto a second card;
BLOCKSIZE 20fits the larger record, and "the shorter records … will be written with proper length, and will always begin a new buffer. If this short record was only 10 words long, it would be necessary to specify BEGIN … to avoid grouping of the short records" (J 90.05.04): an under-documented boundary rule; see Open questions. - SPECIF idioms: symbolic unit assignment (
UNIT1 'D1'…'D4','C1'–'C3'),OPENW(no rewind before open),CLOSER(rewind only on close), and low density (LOW) on every BCD tape destined for peripheral card/print equipment but not on the binary master tapes (J 90.05 listing, PDF p. 195; option meanings at J 02.06.D). - The compiler punched matching Loader
*FILE/*SPECcards (J 90.05 listing, PDF p. 198). The twelfth card, BONDORDERFILE's, prints*SPEC 06and matches its*FILE 06. The conversion read*SPEC 05there and called it a keying anomaly of the 1961 listing until 2026-09-06; a column measurement of the scan showed both lines print the same weak-topped 6, and the conversion now reads06. - F/J divergence: the F sample simply assumes files exist (
OPEN ALL FILES.with no environment;FILE MASTER IN ERROR.FILEagainst an undeclared file, F p. 91). Under J, "All records associated with the file must be named on the FILE card" and every file needs a FILE card (J 02.06.C, 02.07.08); qualified names are barred from the environment division (J 02.03.C).
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, ...
- F renames the shared simple name EMPLOYEE.NUMBER (it occurs in MASTER, DETAIL, CHECK, PAYRECORD, BONDORDER) and afterwards qualifies the synonym:
DETAIL EMPLOYNO,MASTER EMPLOYNO,DPT INSPREM,TABLE.ITEM INSPREM (INDEX)(F pp. 91–94). F's CALL description permits synonyms for compound names and requires synonyms to be single names, but never requires old.name uniqueness (F p. 59); indeed F p. 59's own example isCALL (INSURANCE.PREM) INSPREM, the very rename this sample uses against two INSURANCE.PREM fields. - J's rule: "The (old.name) in a CALL statement must be unique … or if sufficient qualifiers are used to identify it uniquely. The use of record.names should be avoided" (J 02.04.05); subscripted old.names are barred (J 90.01.01.i). The J sample complies: each old.name is a qualified unique field, and each synonym (
M.EMP.NO,D.DEPT,M.BND.DED,M.BND.ACC) is thereafter used unqualified. CALL is also the sanctioned device for reducing qualified names to the single words demanded by the environment division and CRYPT (J 02.03.C, J 90.01.01.ii).
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. ...
- Only the
GET record.nameform is ever used, neverGET RECORD FROM file.name(whose GIM description J explicitly corrects and restricts, J 02.07.04). A comma precedesAT ENDin every sample GET although the general form shows none (F p. 109). - The
AT ENDclause is exercised in both allowed flavors (an imperativeDOand an imperativeGO TO) and is limited to "a single imperative statement only" (J 02.07.05/06). The asymmetry is semantic: masters exhausting must return to keep draining details (DO END.OF.MASTERS), details exhausting need not (GO TO END.OF.DETAILS). - The multi-destination conditional
GO TO … WHEN …, … WHEN …relies on documented fall-through: "If none of the conditional expressions … is found to be true, control passes to the next clause or sentence in sequence" (F p. 48): HIGH.DETAIL is placed immediately after and is reached by fall-through; in F that is its only entry, while J's END.OF.DETAILS also enters it by an explicitGO TO HIGH.DETAIL(st. 198). - Unmatched-record handling shows both FILE forms: F files the same record into alternate files (
FILE MASTER IN ERROR.FILE,FILE BONDORDER IN ERROR.FILE, F pp. 91, 94 — theINform for a record "associated with several output files", J 02.07.08.D.1.b); J instead builds a dedicated ERROROUT record (MOVE 'M' TO ERRORTYPE, MOVE MASTER DAT TO ERROROUT INFO, FILE ERROROUT, st. 193) so every FILE is the plain form. - End-of-run:
MOVE CORRESPONDING …, FILE PAYRECORD, CLOSE ALL FILESthen F:STOP 1234.(theSTOP ngeneral form, F pp. 92, 109) versus J:STOP RUN.(st. 199): "A STOP RUN instruction must be included in each program"; it closes all open files itself (J 02.04.06 #9). F/J divergence: F's Appendix 2 knows no STOP RUN; a 7090 compiler must accept STOP RUN and treat it as mandatory.
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.
- HIGH.VALUE is one of the four pre-defined figurative constants (F p. 112 glossary; values:
(in the 709 sequence,9under COM — J 02.04.01.a). The J deck selects no COM OPTION card, so the sentinel is('s. - F/J divergence: J rules that "HIGH.VALUE, LOW.VALUE and BLANK may be compared to alphameric fields only" (J 02.04.01.b), and its figurative-constant chart marks HIGH.VALUE into external-decimal targets as doubtful (starred) and into internal decimal as "Illegal*" (J 02.04.02). F's EMPLOYNO fields are numeric
99/9999(F p. 95): the 1960 sample would draw diagnostics from the 1962 compiler. The J sample re-types every employee-number field asAA/AAAAalphameric (listing st. 4–5, 25–26), exactly what the rule requires. Group-levelSET M.EMP.NO = HIGH.VALUEalso leans on two other rules: a group without a pictorial is alphameric (J 02.05.E.1.c) andSET alpha.1 = alpha.2is the one non-arithmetic SET allowed (J 02.04.05). - The equality tests compare 6-character non-format groups; non-format fields "are compared alphamerically" (J 02.04.C.4), and the routing comparisons (
=,LT) are alphameric-vs-alphameric as J 02.04.C.1 requires.
9.5.4 DO, sections, and control flow
- DO of a one-sentence procedure.
AT END DO END.OF.MASTERStargets a named sentence, not a section: legal because a DO-able procedure is "either named sentences or sections", with sections required only for multi-sentence bodies (F p. 49, p. 50). - DO'd code that never returns. END.OF.MASTERS, entered by DO, exits via
GO TO END.OF.RUNon the final pass (both versions). Likewise SEARCH, entered byDO SEARCH FOR INDEX = 1(1)12, escapes its own loop withGO TO NET(F p. 94; J st. 225). Both strain the closed-subroutine doctrine (a DO'd procedure "must be entered only through the use of a DO command" and implicitly returns to its caller (F p. 50)) by abandoning the return path mid-execution. The compiled sample proves the implementation tolerates it. See Ambiguities. - The indexed DO.
DO SEARCH FOR INDEX = 1(1)12.(F p. 92; J st. 206) matches the general formDO procedure.name FOR index.name = p(q)r(F pp. 50, 108), the index being "a field which has been defined in the data description as an integer" (F p. 50): F declares INDEX as external99in the CURRENT record (F p. 100); J moves it to WORKING asIR99(listing st. 121) per the internal-mode efficiency doctrine (J 02.03.D). Relevant implemented semantics: a DO section is "always … performed at least once regardless of the values of the loop control variables", and no object-time subscript-bounds check exists (J 90.01.02). Arrays are 1-origin: "The initial value of an array is A(1) and not A(0)" (J 02.04.07.01). - The subscript-copy idiom. Inside SEARCH, J tests
TABLE.ITEM RATE (INDEX)but then executesMOVE INDEX TO POS, MOVE INSPREM (POS) TO …, MOVE RETPREM (POS) TO …(st. 225). This is a direct application of the published advice: every unique array/subscript combination costs a positional indicator, and "when a subscript changes value, all positional indicators containing that subscript will be re-evaluated. Use of the same subscript names for multiple purposes generally causes unnecessary calculations … but it will not be incorrect" (J 90.01.02; mechanism at J 02.04.D). By subscripting the premiums with POS, only the RATE indicator recomputes on each loop step. F's original uses INDEX for all three references (F p. 94). Subscripts are written space-separated after a qualified name:TABLE.ITEM RATE (INDEX). - Sections in practice. F defines four (
FICA.ROUTINE,WITHOLDING.TAX.ROUTINE,BOND.ROUTINE,SEARCH), J five (addingDEPARTMENT.END), far under the limit of 35 sections (J 90.01.05.b). All follow the patternname. BEGIN SECTION.…END name.(F pp. 56–57); the closing END may itself be labeled to give the section an internal exit point (BOND.END. END BOND.ROUTINE.,SEARCH.END. END SEARCH.— F p. 94; J st. 223, 226), the target of forwardGO TOs from inside the section. BOND.ROUTINE also loops internally by backwardGO TO BOND.CALCULATION(F p. 94). DEPARTMENT.END is DO'd from two different callers (J st. 199, 200), the explicitly permitted "addressing of a procedure by more than one DO command" (F p. 50). - Conditional DO-then-continue.
CHECK.NEW.DEPT. IF CURRENT.DEPT IS NOT EQUAL TO D.DEPT THEN DO DEPARTMENT.END OTHERWISE GO TO COMPUTE.PAY.followed by a sentence that runs only after the DO returns (J st. 200–201): the standard idiom for "call on condition, else skip the post-processing".
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
-
Expressions rely on documented precedence (unary TR/ABS/−, then
**, then*/, then+-, left-to-right within a level — F p. 107; J 02.04.05.01.b):SET DETAIL GROSS = DETAIL GROSS + MASTER RATE * 40(F p. 92); parentheses used only where needed:(DETAIL HOURS - 40) * MASTER RATE * 1.5(F p. 92),(WORKING HOURS * 1.5 -20) * MASTER RATE(J st. 203, an algebraic refactoring of F's two-step overtime computation). -
Numeric literals appear with and without a leading integer digit:
0.03,1.5,144.00(F pp. 92–94;1.5is on p. 92),.03(J st. 211),40.0(J st. 203). -
The TR clamp. J replaces F's IF/OTHERWISE zero-floor on withholding tax with a single statement (J st. 215):
SET WORKING WHT = WORKING WHT * TR(WORKING WHT GT 0),TR converts the parenthesized conditional to arithmetic 1 or 0 (truth functions, F p. 24; TR listed as a unary operator, F p. 106; in J's operator hierarchy at J 02.04.05.01.b but otherwise barely mentioned). This is the only TR usage in either manual's sample program, and the only compiled one; F p. 24 gives the defining worked example
SET DISCOUNT = ORDER.AMOUNT * .05 * TR (ORDER.AMOUNT IS GREATER THAN 1000)., confirming the operator survived into the implemented language. -
Staged arithmetic. F computes directly into record fields (
SET DETAIL GROSS = …); J stages everything through the internal right-justified WORKING area and only MOVEs results outward (st. 202–208): the practice J 02.03.D recommends ("fields frequently referenced in arithmetic expressions should be converted to internal form right justified", J 02.04.05). -
ADD a TO bwith multiple targets in one command:ADD M.BND.DED TO M.BND.ACC,INTERNAL.TOTALS BONDEDUCTION.(J st. 218).
9.5.7 MOVE in practice
- One source, many destinations:
MOVE DETAIL HOURS TO WORKING HOURS, PAYRECORD HRS.(J st. 202);MOVE INSPREM (POS) TO INS.PREM, WORKING INSURANCE(J st. 225): a single MOVE feeding an edited report field and an internal accumulator, exercising automatic conversion (numeric → edited and external → internal; J 02.04.03). - Whole records and groups as operands:
MOVE DETAIL TO ERROROUT INFO(a 3-word record into anA(23)field, J st. 196) andMOVE MASTER DAT TO ERROROUT INFO(a group, st. 193): groups without pictorials are alphameric, and "all types of data may be moved into an alphameric field but the contents of an alphameric field may only be moved to another alphameric field" (J 02.04.03.c). - Figurative sources:
MOVE ZEROS TO INTERNAL.TOTALS, GRAND.TOTALSbulk-clears entire level-1 hierarchies at start of run (J st. 188);MOVE BLANKS TO PAYRECORD EMPLOYNO, PAYRECORD NAME(F p. 93);MOVE BLANKS TO PAYRECORD BONDEDUCTION,PAYRECORD BONDENOMINATIONblanks edited fields (J st. 205); see Ambiguities on the chart's starred "blanks*" entry (J 02.04.02). - Alphameric literals as data:
MOVE 'M' TO MASTER ERRORCODE(F p. 91),MOVE 'D' TO ERRORTYPE(J st. 196), andMOVE 'GT' TO PAYRECORD DEPARTMENT(J st. 199): the reserved abbreviation GT is harmless inside quotes.
9.5.8 MOVE/ADD CORRESPONDING in practice — including the sharpest F/J rule divergence
- Multi-target CORRESPONDING is routine:
MOVE CORRESPONDING DETAIL TO PAYRECORD, CHECK(F p. 93; J st. 208),ADD CORRESPONDING DETAIL TO DEPARTMENT.TOTAL, GRAND.TOTAL(F p. 93),ADD CORRESPONDING WORKING TO MASTER TOTALS, INTERNAL.TOTALS(J st. 208 — note the qualified groupMASTER TOTALSas a target; similarlyADD CORRESPONDING DETAIL TOTALS TO MASTER TOTALS, F p. 93). - The J sample is engineered around the implemented matching rule, "correspondence is determined at the lowest possible level on the basis of name only. All qualifiers must be present and identical through the level of the name itself" (J 02.04.04): WORKING's FICA/WHT deliberately do not land in MASTER TOTALS (they are handled inside the FICA/withholding sections), because TOTALS has no children by those names; PAYRECORD's HRS/INS.PREM/RET.PREM names keep those fields out of CORRESPONDING traffic and are loaded explicitly (st. 199, 202, 225).
MOVE CORRESPONDING MASTER TO BONDORDER(st. 220–221) exercises the group-to-elementary case of J 02.04.04.c: MASTER's EMPLOYEE.NUMBER group corresponds to BONDORDER's elementaryA(6)EMPLOYEE.NUMBER and moves as alphameric. - F-sample reliance on name-only matching. F defines correspondence merely as "a field having the same name" in the receiving area (F p. 43). Its
MOVE CORRESPONDING DETAIL TO PAYRECORD, CURRENT(F p. 93) expects DETAIL's DEPARTMENT, buried at level 4 under DATA EMPLOYEE.NUMBER, to reach CURRENT's level-2 DEPARTMENT. Under the implemented qualifier-chain rule that pair does not correspond (missing qualifiers; J 02.04.04.b), and the J rewrite replaces it with an explicitMOVE D.DEPT TO CURRENT.DEPT(st. 201). Likewise F'sMOVE CORRESPONDING DEPARTMENT.TOTAL TO PAYRECORD(F p. 93) can never transfer INSURANCE.PREM/RETIREMENT.PREM/BONDPURCHASES (PAYRECORD's fields are named INSURANCE/RETIREMENT/BONDENOMINATION), under either edition's rule: an apparent latent defect of the F sample; J instead prints department totals from their own record. Gold for a compiler writer: implement J 02.04.04, and expect 1960-vintage code to have assumed less.
9.6 What the compilation listing reveals about the source language
(Source-level observations only; for generated code see Appendix 90.02 material.)
- Statement numbering. The compiler assigns numbers of the form
xxxxx,00to every "Procedure sentence, Data Description entry or Environment card" (J 02.02.B.1.b), one continuous series across the whole program: data 1,00–172,00, environment 173,00–186,00, procedure 187,00–229,00 (J 90.05 listing, PDF pp. 192–197). Error messages addressline,clause("The last two [digits] … tell which clause is being referenced. The digit(s) preceding the comma tell which line"), with9999,99reserved for errors "not confined to a single source statement" (J 02.02.B.2). Because this compilation is clean, only,00forms appear. Every number aligns one-to-one with a sentence. The apparent mid-sentence and shared numbers at 217–221 were a printer half-line stagger in the transcription, corrected 2026-08-05 (§8.5.7-m). - Generated names for unnamed source constructs. "In some cases, names generated by the Compiler, i.e., GN)nnn, are shown in the name field of Procedure statements or Data entries unnamed by the programmer" (J 02.02.B.1.c). In the sample:
GN)001–GN)056for unnamed data constants,GN)057for the bare REDEF entry,GN)000for the opening CALL sentence, andGN)077,GN)078,GN)083for the unnamed END sentences of FICA.ROUTINE, WITHOLDING.TAX.ROUTINE and DEPARTMENT.END, while the programmer-labeledBOND.END./SEARCH.END.END sentences keep their own names (J 90.05 listing, PDF pp. 192–197). Generated names print abutting the following keyword (GN)077END FICA.ROUTINE.). The)in generated names cannot occur in programmer names, so the two name spaces cannot collide; the dictionary budget covers "all program names whether defined by the programmer or generated" (3500 max, J 90.01.05.a). - Name width vs. listing width. 30-character names are legal (F p. 15); the listing's name column is narrower, so
BONDACCUMULATIONprints wrapped (BONDACCUMULATI/ON) with the location value only on the completing line (J 90.05 listing, PDF p. 192 and conversion notes): a display convention, not a language limit. - Echo fidelity. The listing reproduces the source's own level-number style (
1vs01), its spelling (WITHOLDING), its mode/justify prefixes (IR99V999), and the fixed-column abutments (1RECORD,SPECIFINPUTMASTER): the listing is a reformatted echo of cards, and the columns of the coding form (name 7–22, type 25–30, description 31–71, continuation 72 for data/environment) remain visible through it (J 02.06.B.1; J 02.03.A.2). - Diagnostic summary. A clean run ends with the single line
NO ERRORS WERE DETECTED DURING COMPILATIONafter the CTD/CTE phase letters (J 90.05 listing, PDF p. 197). Severity codes and the message catalog are in Appendix 90.04. - Deck identity. The running head
DATE 10/18/61 TIME 2.45 ACCOUNT … ID. CT PUBLICATIONS PAGE nis compiler output built from the control card's identifier, which is also punched into the*CTEXT/*CTENDloader cards (J 90.05 listing, PDF pp. 192, 198, 216; cf. secondary.identifier, J 02.01.01).
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:
- Edited-field behavior in the flesh: floating dollar signs hug the first significant digit (
$294.12,$364.16under picture$8889.99);8positions zero-suppress to blanks (HOURS40.0under8889.9; GROSS94.00under88889.99); constant fields embedded in the record always print (the-date separators appear even on the grand-total line, whose date fields were blanked:GT … - - 389.5 2730.39 449.35); fields blanked byMOVE BLANKSprint empty (bond columns for employees without bond deductions). - The CHECKFILE is a print-image tape: its listing shows the carriage-control characters
1and2as leading data characters of the two lines of each check, exactly as described in the record (CNTRLCHAR A '1',CNTRLCHARSECLIN … A '2'; J 90.05.03). - ERRORFILE records are single-character-code + image:
M011001AJAX T(ERRORTYPEM+ MASTER DAT),D061500100661400(ERRORTYPED+ the 18-character DETAIL record image insideA(23)INFO), confirming the group/record-to-alphameric MOVEs of 9.5.7. - The page carries printer artifacts of the original:
WCO Jwhere other reports printWOO J, andMOCREwhere the expected name would be MOORE per the conversion notes' inference. These are print/test-data anomalies of the 1961 run, not language phenomena (file conversion notes, J 90.05). The print is also skewed: every line rises to the right by about one line height across the page (J28-6169/images/page-217.png). The transcription read that skew as a stagger of the trailing amount columns onto the row above. Jack authorized the correction on 2026-09-14, and the transcription now reads each line along its own baseline. The scan shows one straight tilted baseline per line, and the arithmetic of every line confirms the baseline reading (docs/design/m6-acceptance.mdM6-2).
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)
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.- F's name-only CORRESPONDING vs J's qualifier-chain rule; F sample moves that match nothing under J semantics.
- 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.
MOVE BLANKSinto edited/external fields is starred "doubtful" in J's chart yet compiles with no errors in the sample.*COMPILE LISTon the sample listing vs the documented$CMPLEcontrol card.- REDEF coding convention (F's leveled, named-line REDEF vs J's bare line + same-level first item).
- GO TO exits from DO'd procedures vs the closed-subroutine doctrine.
- The PAYFILE short-record/BEGIN boundary rule quoted in J 90.05.04 has no stated general form.