Data-Dictionary

From Webhuis wiki
Revision as of 22:55, 24 March 2026 by Martin (talk | contribs)
Jump to navigation Jump to search

Data Dictionary

Project: pgcobol — Prime Numbers Application
Version: 1.0 (reverse-engineered)
Date: 2026-03-17



1. Conventions

Column Meaning
Name COBOL data-name as written in source
Level 01 / 03 / 05 / 07 hierarchy level
Picture COBOL PICTURE clause
Usage DISPLAY (default) / COMP-3 / COMP-5
Source Copybook or program where defined
Description Semantic meaning and valid values

Condition-names (88-level) are listed under the field they qualify.



2. Copybook: primes-session.cpy

Control block for the session (main → business-logic) tier.

Name Level Picture Usage Description
primes-session 01 Root of session control block; passed as linkage to primesgen
methods 03 X(32) DISPLAY Operation verb set by primesmain before calling primesgen
report-primes 88 VALUE “report” — run the report path
generate-primes 88 VALUE “generate” — run the sieve path
start-primes 88 VALUE “start” — (reserved, not used in current flow)
stop-primes 88 VALUE “stop” — (reserved, not used in current flow)
invalid-method 88 VALUE “bad” — sentinel for bad dispatch
session-result 03 9(2) DISPLAY Result code written back by primesgen; initial value ZERO
session-method-ok 88 VALUE 0 — operation succeeded
session-method-nok 88 VALUE 1 — operation failed
session-method-eof 88 VALUE 9 — cursor exhausted (end of data)



3. Copybook: primes-dal.cpy

Control block for the DAL (business-logic → data-access) tier.

Name Level Picture Usage Description
primes-dal 01 Root of DAL control block; passed as linkage to primes
dal-methods 03 X(32) DISPLAY Operation verb set by caller
next-prime 88 VALUE “next-prime” — fetch next row from cursor
next-divider 88 VALUE “next-divider” — select divider by ident
write-prime 88 VALUE “write” — insert prime into table
db-cursor 88 VALUE “cursor” — start transaction and open cursor
db-connect 88 VALUE “connect” — connect to PostgreSQL
db-disconnect 88 VALUE “disconnect” — disconnect from PostgreSQL
invalid-method 88 VALUE “bad” — sentinel for bad dispatch
primes-data 03 One-row data payload
primes-sequence 05 9(9) DISPLAY Sequence / ident of the current prime row
prime-number 05 9(9) DISPLAY Value of the current prime
dal-result 03 9(2) DISPLAY Result code written back by primes; initial value ZERO
dal-method-ok 88 VALUE 0 — operation succeeded
dal-method-nok 88 VALUE 1 — operation failed
dal-method-eof 88 VALUE 99 — cursor exhausted



4. Copybook: primes-ui.cpy

Control block for the UI tier; included by all four programs.

Name Level Picture Usage Description
primes-ui 01 Root of UI control block; passed as linkage to primesui
ui-methods 03 X(32) DISPLAY Operation verb set by caller
write-ui 88 VALUE “write” — add one prime row to print buffer
message-ui 88 VALUE “log-message” — display console message
start-ui 88 VALUE “start” — open print file
stop-ui 88 VALUE “stop” — flush and close print file
process-message 03 Structured console log record
program-name 05 X(20) DISPLAY Name of the calling program (for log messages)
program-line 05 Group: paragraph name + message text
program-paragraph 07 X(20) DISPLAY Name of the calling paragraph
program-message 07 X(92) DISPLAY Human-readable status or error message
u-primes 03 One prime row for the print writer
u-sequence 05 9(9) DISPLAY Prime sequence number (ident) to print
u-number 05 9(9) DISPLAY Prime value to print
ui-method-result 03 9(2) DISPLAY Result code from primesui; initial value ZERO
ui-method-ok 88 VALUE 0 — operation succeeded
ui-method-nok 88 VALUE 1 — operation failed



5. Copybook: primes-table.cpy

SQL host variable — character (DISPLAY) format.

Name Level Picture Usage Description
primes-table 01 Host variable group for SQL bind/into
ident 03 S9(9) DISPLAY Row identity (sequence number), signed
prime 03 S9(9) DISPLAY Prime value, signed



6. Copybook: primes_table.cpy

SQL host variable — packed-decimal (COMP-3) format. Alternate version of primes-table.cpy.

Name Level Picture Usage Description
primes_table 01 Host variable group for SQL bind/into
ident 03 S9(9) COMP-3 Row identity, packed decimal
prime 03 S9(9) COMP-3 Prime value, packed decimal



7. Copybook: SQLCA.cpy

GixSQL SQL Communications Area — standard across all embedded-SQL programs.

Name Level Picture Usage Description
SQLCA 01 SQL communications area
SQLCAID 05 X(8) DISPLAY SQLCA identifier string
SQLCABC 05 S9(9) COMP-5 Byte length of SQLCA
SQLCODE 05 S9(9) COMP-5 SQL return code: 0 = success, negative = error, +100 = not found
SQLERRM 05 Error message group
SQLERRML 49 S9(4) COMP-5 Length of error message text
SQLERRMC 49 X(70) DISPLAY Error message text
SQLERRP 05 X(8) DISPLAY Error program (not used)
SQLERRD 05 S9(9) OCCURS 6 COMP-5 Diagnostic codes; SQLERRD(3) = rows processed
SQLWARN 05 Warning flags group (not used)
SQLWARN0SQLWARN7 10 X(1) DISPLAY Individual warning flags
SQLSTATE 05 X(5) DISPLAY ANSI SQL state code



8. Program: primesmain — Working Storage

Name Level Picture Usage Source Description
filler 01 X(32) VALUE “Start WS primesmain” DISPLAY primesmain.cbl Debug marker to locate WS in memory dump
commandline-args 01 X(32) DISPLAY primesmain.cbl Command-line argument accepted from OS
execute-generate 88 primesmain.cbl VALUE “generate”
execute-report 88 primesmain.cbl VALUE “report”
primes-session 01 (group) COPY See §2
primes-ui 01 (group) COPY See §4



9. Program: primesgen — Working Storage

Name Level Picture Usage Description
filler 01 X(32) VALUE “Start WS primesgen” DISPLAY Debug WS marker
file-buffer 01 X(132) DISPLAY FD record area for fprinter (declared but file not opened in primesgen)
printer 01 Print control group (unused in primesgen; print handled by primesui)
print-buffer 03 X(132) DISPLAY Line buffer
line-number 03 99 VALUE 99 DISPLAY Current line counter
page-number 03 9(4) VALUE ZERO DISPLAY Current page counter
test-quot 01 9(9) DISPLAY Quotient from DIVIDE in sieve loop
primes 01 Local sieve control group (mirrors primes-dal structure)
gen-methods 03 X(32) DISPLAY Method verb for internal DAL calls
query-process 88 VALUE “query”
start-process 88 VALUE “start”
next-divider 88 VALUE “get”
write-prime 88 VALUE “put”
stop-process 88 VALUE “stop”
primes-result 03 9(2) VALUE ZERO DISPLAY Result of sieve DAL call
init-primes-ok 88 VALUE 1
first-divider-ok 88 VALUE 2
next-divider-ok 88 VALUE 3
test-number 03 9(9) DISPLAY Current candidate being tested for primality
test-number-sqr 03 9(9)V9(9) DISPLAY Square root of test-number (decimal)
test-divider 03 9(9) DISPLAY Current trial divisor fetched from DB
test-rest 03 9(9)V9(9) DISPLAY Remainder from DIVIDE
old-test-number 03 9(9) DISPLAY Previous test-number (diagnostic / unused)
old-ident 03 9(9) DISPLAY ident of the last divider fetched; incremented before next fetch
new-ident 03 9(9) DISPLAY old-ident + 1; used as key in SELECT to get next divider
primes-ui 01 (group) COPY — see §4
primes-dal 01 (group) COPY — see §3

Linkage section:

Name Source Description
primes-session COPY primes-session Passed in by primesmain



10. Program: primes (DAL) — Working Storage

Name Level Picture Usage Description
filler 01 X(32) VALUE “Start WS primes” DISPLAY Debug WS marker
DATASRC 01 X(64) VALUE “pgsql://localhost:5432/primes&default_schema=primes” DISPLAY GixSQL connection string
DBUSR 01 X(64) VALUE “primes_user” DISPLAY Database user name
DBPWD 01 X(64) VALUE “pr1mes_user” DISPLAY Database password (plain-text)
CUR-STEP 01 X(16) DISPLAY Diagnostic: current SQL step (“CONNECT” / “DISCONNECT”)
primes-row 01 FETCH target for cursor
r-ident 03 9(9) COMP-3 Fetched ident value
r-prime 03 9(9) COMP-3 Fetched prime value
prime-count 01 9(9) DISPLAY (Unused in current flow)
prime_seq 01 9(9) DISPLAY (Unused in current flow)
divider 01 9(9) DISPLAY (Unused in current flow)
primes 01 Local copy of sieve control (mirrors primes-dal; used for internal paragraphs)
SQLCA 01 COPY SQLCA — see §7
primes-table 01 EXEC SQL INCLUDE primes-table — see §5
primes-ui 01 COPY primes-ui — see §4

Linkage section:

Name Source Description
primes-dal COPY primes-dal Passed in by primesgen



11. Program: primesui — Working Storage

Name Level Picture Usage Description
filler 01 X(32) VALUE “start ws primesui” DISPLAY Debug WS marker
primes-table 01 6-column print accumulator (OCCURS 6)
primes-cel 03 OCCURS 6 INDEXED primes-idx One cell per prime entry on a print line
t-ident 05 Z(9) DISPLAY Sequence number, zero-suppressed
filler 05 X(2) DISPLAY Column separator spaces
t-prime 05 Z(9) DISPLAY Prime value, zero-suppressed
filler 05 X(2) DISPLAY Column separator spaces
table-header 01 Heading row (OCCURS 6) — “Sequence Prime” × 6
printer 01 Print control group
print-buffer 03 X(132) DISPLAY Current line being built
primes-prt-status 03 X(2) DISPLAY File-status code for fprinter
page-number 03 9(4) VALUE 1 DISPLAY Current page number
print-new-page 03 9 VALUE 1 DISPLAY Flag: 1 = new page needed
new-page 88 VALUE 1
primes-heading 01 X(118) VALUE “primes overview” DISPLAY Page heading text
primes-footing 01 Page footing group
filler 03 X(118) VALUE SPACE DISPLAY Left padding
filler 03 X(6) VALUE “page:” DISPLAY Label
f-page-number 03 Z(3)9 VALUE 1 DISPLAY Formatted page number
primes-line 01 (Declared but not used in current flow)
primes-total 01 (Declared but not used in current flow)
primes-count 03 9(8) DISPLAY (Declared but not used in current flow)

Linkage section:

Name Source Description
primes-ui COPY primes-ui Passed in by all callers



12. Database Objects

Object Type Schema Owner Definition
primes Schema primes_user Container schema
asc_ident Sequence primes primes_user INTEGER, START 1, INCREMENT 1
primes Table primes primes_user See below
primescursor Cursor runtime DECLARE … CURSOR FOR SELECT * FROM primes

Table: primes.primes

Column Type Nullable Default Description
ident INTEGER YES nextval(‘primes.asc_ident’) Auto-assigned insertion sequence
prime INTEGER YES Prime number value