Data-Dictionary: Difference between revisions
Jump to navigation
Jump to search
(Replaced content with "<span id="data-dictionary"></span> = Data Dictionary = '''Project:''' pgcobol — Prime Numbers Application<br /> '''Version:''' 1.0 (reverse-engineered)<br /> '''Date:''' 2026-03-17 ----- <span id="conventions"></span> == 1. Conventions == {| ! Column ! Meaning |- | Name | COBOL data-name as written in source |- | Level | 01 / 03 / 05 / 07 hierarchy level |- <tern/CobolDesign/03_data_dictionary.mediawiki" 1085L, 16199B 1,1 Top") Tag: Replaced |
No edit summary |
||
| Line 22: | Line 22: | ||
| 01 / 03 / 05 / 07 hierarchy level |
| 01 / 03 / 05 / 07 hierarchy level |
||
|- |
|- |
||
| Picture |
|||
<tern/CobolDesign/03_data_dictionary.mediawiki" 1085L, 16199B 1,1 Top |
|||
| 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. |
|||
----- |
|||
<span id="copybook-primes-session.cpy"></span> |
|||
== 2. Copybook: primes-session.cpy == |
|||
'''Control block for the session (main → business-logic) tier.''' |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>primes-session</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Root of session control block; passed as linkage to primesgen |
|||
|- |
|||
| <code>methods</code> |
|||
| 03 |
|||
| X(32) |
|||
| DISPLAY |
|||
| Operation verb set by primesmain before calling primesgen |
|||
|- |
|||
| — <code>report-primes</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “report” — run the report path |
|||
|- |
|||
| — <code>generate-primes</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “generate” — run the sieve path |
|||
|- |
|||
| — <code>start-primes</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “start” — (reserved, not used in current flow) |
|||
|- |
|||
| — <code>stop-primes</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “stop” — (reserved, not used in current flow) |
|||
|- |
|||
| — <code>invalid-method</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “bad” — sentinel for bad dispatch |
|||
|- |
|||
| <code>session-result</code> |
|||
| 03 |
|||
| 9(2) |
|||
| DISPLAY |
|||
| Result code written back by primesgen; initial value ZERO |
|||
|- |
|||
| — <code>session-method-ok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 0 — operation succeeded |
|||
|- |
|||
| — <code>session-method-nok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 1 — operation failed |
|||
|- |
|||
| — <code>session-method-eof</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 9 — cursor exhausted (end of data) |
|||
|} |
|||
----- |
|||
<span id="copybook-primes-dal.cpy"></span> |
|||
== 3. Copybook: primes-dal.cpy == |
|||
'''Control block for the DAL (business-logic → data-access) tier.''' |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>primes-dal</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Root of DAL control block; passed as linkage to primes |
|||
|- |
|||
| <code>dal-methods</code> |
|||
| 03 |
|||
| X(32) |
|||
| DISPLAY |
|||
| Operation verb set by caller |
|||
|- |
|||
| — <code>next-prime</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “next-prime” — fetch next row from cursor |
|||
|- |
|||
| — <code>next-divider</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “next-divider” — select divider by ident |
|||
|- |
|||
| — <code>write-prime</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “write” — insert prime into table |
|||
|- |
|||
| — <code>db-cursor</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “cursor” — start transaction and open cursor |
|||
|- |
|||
| — <code>db-connect</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “connect” — connect to PostgreSQL |
|||
|- |
|||
| — <code>db-disconnect</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “disconnect” — disconnect from PostgreSQL |
|||
|- |
|||
| — <code>invalid-method</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “bad” — sentinel for bad dispatch |
|||
|- |
|||
| <code>primes-data</code> |
|||
| 03 |
|||
| — |
|||
| — |
|||
| One-row data payload |
|||
|- |
|||
| <code>primes-sequence</code> |
|||
| 05 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Sequence / ident of the current prime row |
|||
|- |
|||
| <code>prime-number</code> |
|||
| 05 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Value of the current prime |
|||
|- |
|||
| <code>dal-result</code> |
|||
| 03 |
|||
| 9(2) |
|||
| DISPLAY |
|||
| Result code written back by primes; initial value ZERO |
|||
|- |
|||
| — <code>dal-method-ok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 0 — operation succeeded |
|||
|- |
|||
| — <code>dal-method-nok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 1 — operation failed |
|||
|- |
|||
| — <code>dal-method-eof</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 99 — cursor exhausted |
|||
|} |
|||
----- |
|||
<span id="copybook-primes-ui.cpy"></span> |
|||
== 4. Copybook: primes-ui.cpy == |
|||
'''Control block for the UI tier; included by all four programs.''' |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>primes-ui</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Root of UI control block; passed as linkage to primesui |
|||
|- |
|||
| <code>ui-methods</code> |
|||
| 03 |
|||
| X(32) |
|||
| DISPLAY |
|||
| Operation verb set by caller |
|||
|- |
|||
| — <code>write-ui</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “write” — add one prime row to print buffer |
|||
|- |
|||
| — <code>message-ui</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “log-message” — display console message |
|||
|- |
|||
| — <code>start-ui</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “start” — open print file |
|||
|- |
|||
| — <code>stop-ui</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “stop” — flush and close print file |
|||
|- |
|||
| <code>process-message</code> |
|||
| 03 |
|||
| — |
|||
| — |
|||
| Structured console log record |
|||
|- |
|||
| <code>program-name</code> |
|||
| 05 |
|||
| X(20) |
|||
| DISPLAY |
|||
| Name of the calling program (for log messages) |
|||
|- |
|||
| <code>program-line</code> |
|||
| 05 |
|||
| — |
|||
| — |
|||
| Group: paragraph name + message text |
|||
|- |
|||
| <code>program-paragraph</code> |
|||
| 07 |
|||
| X(20) |
|||
| DISPLAY |
|||
| Name of the calling paragraph |
|||
|- |
|||
| <code>program-message</code> |
|||
| 07 |
|||
| X(92) |
|||
| DISPLAY |
|||
| Human-readable status or error message |
|||
|- |
|||
| <code>u-primes</code> |
|||
| 03 |
|||
| — |
|||
| — |
|||
| One prime row for the print writer |
|||
|- |
|||
| <code>u-sequence</code> |
|||
| 05 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Prime sequence number (ident) to print |
|||
|- |
|||
| <code>u-number</code> |
|||
| 05 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Prime value to print |
|||
|- |
|||
| <code>ui-method-result</code> |
|||
| 03 |
|||
| 9(2) |
|||
| DISPLAY |
|||
| Result code from primesui; initial value ZERO |
|||
|- |
|||
| — <code>ui-method-ok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 0 — operation succeeded |
|||
|- |
|||
| — <code>ui-method-nok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 1 — operation failed |
|||
|} |
|||
----- |
|||
<span id="copybook-primes-table.cpy"></span> |
|||
== 5. Copybook: primes-table.cpy == |
|||
'''SQL host variable — character (DISPLAY) format.''' |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>primes-table</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Host variable group for SQL bind/into |
|||
|- |
|||
| <code>ident</code> |
|||
| 03 |
|||
| S9(9) |
|||
| DISPLAY |
|||
| Row identity (sequence number), signed |
|||
|- |
|||
| <code>prime</code> |
|||
| 03 |
|||
| S9(9) |
|||
| DISPLAY |
|||
| Prime value, signed |
|||
|} |
|||
----- |
|||
<span id="copybook-primes_table.cpy"></span> |
|||
== 6. Copybook: primes_table.cpy == |
|||
'''SQL host variable — packed-decimal (COMP-3) format. Alternate version of primes-table.cpy.''' |
|||
{| |
|||
! Name |
|||
! Level |
|||
! Picture |
|||
! Usage |
|||
! Description |
|||
|- |
|||
| <code>primes_table</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Host variable group for SQL bind/into |
|||
|- |
|||
| <code>ident</code> |
|||
| 03 |
|||
| S9(9) |
|||
| COMP-3 |
|||
| Row identity, packed decimal |
|||
|- |
|||
| <code>prime</code> |
|||
| 03 |
|||
| S9(9) |
|||
| COMP-3 |
|||
| Prime value, packed decimal |
|||
|} |
|||
----- |
|||
<span id="copybook-sqlca.cpy"></span> |
|||
== 7. Copybook: SQLCA.cpy == |
|||
'''GixSQL SQL Communications Area — standard across all embedded-SQL programs.''' |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>SQLCA</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| SQL communications area |
|||
|- |
|||
| <code>SQLCAID</code> |
|||
| 05 |
|||
| X(8) |
|||
| DISPLAY |
|||
| SQLCA identifier string |
|||
|- |
|||
| <code>SQLCABC</code> |
|||
| 05 |
|||
| S9(9) |
|||
| COMP-5 |
|||
| Byte length of SQLCA |
|||
|- |
|||
| <code>SQLCODE</code> |
|||
| 05 |
|||
| S9(9) |
|||
| COMP-5 |
|||
| SQL return code: 0 = success, negative = error, +100 = not found |
|||
|- |
|||
| <code>SQLERRM</code> |
|||
| 05 |
|||
| — |
|||
| — |
|||
| Error message group |
|||
|- |
|||
| <code>SQLERRML</code> |
|||
| 49 |
|||
| S9(4) |
|||
| COMP-5 |
|||
| Length of error message text |
|||
|- |
|||
| <code>SQLERRMC</code> |
|||
| 49 |
|||
| X(70) |
|||
| DISPLAY |
|||
| Error message text |
|||
|- |
|||
| <code>SQLERRP</code> |
|||
| 05 |
|||
| X(8) |
|||
| DISPLAY |
|||
| Error program (not used) |
|||
|- |
|||
| <code>SQLERRD</code> |
|||
| 05 |
|||
| S9(9) OCCURS 6 |
|||
| COMP-5 |
|||
| Diagnostic codes; SQLERRD(3) = rows processed |
|||
|- |
|||
| <code>SQLWARN</code> |
|||
| 05 |
|||
| — |
|||
| — |
|||
| Warning flags group (not used) |
|||
|- |
|||
| <code>SQLWARN0</code>–<code>SQLWARN7</code> |
|||
| 10 |
|||
| X(1) |
|||
| DISPLAY |
|||
| Individual warning flags |
|||
|- |
|||
| <code>SQLSTATE</code> |
|||
| 05 |
|||
| X(5) |
|||
| DISPLAY |
|||
| ANSI SQL state code |
|||
|} |
|||
----- |
|||
<span id="program-primesmain-working-storage"></span> |
|||
== 8. Program: primesmain — Working Storage == |
|||
{| |
|||
!width="16%"| Name |
|||
!width="16%"| Level |
|||
!width="16%"| Picture |
|||
!width="16%"| Usage |
|||
!width="16%"| Source |
|||
!width="16%"| Description |
|||
|- |
|||
| <code>filler</code> |
|||
| 01 |
|||
| X(32) VALUE “Start WS primesmain” |
|||
| DISPLAY |
|||
| primesmain.cbl |
|||
| Debug marker to locate WS in memory dump |
|||
|- |
|||
| <code>commandline-args</code> |
|||
| 01 |
|||
| X(32) |
|||
| DISPLAY |
|||
| primesmain.cbl |
|||
| Command-line argument accepted from OS |
|||
|- |
|||
| — <code>execute-generate</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| primesmain.cbl |
|||
| VALUE “generate” |
|||
|- |
|||
| — <code>execute-report</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| primesmain.cbl |
|||
| VALUE “report” |
|||
|- |
|||
| <code>primes-session</code> |
|||
| 01 |
|||
| (group) |
|||
| — |
|||
| COPY |
|||
| See §2 |
|||
|- |
|||
| <code>primes-ui</code> |
|||
| 01 |
|||
| (group) |
|||
| — |
|||
| COPY |
|||
| See §4 |
|||
|} |
|||
----- |
|||
<span id="program-primesgen-working-storage"></span> |
|||
== 9. Program: primesgen — Working Storage == |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>filler</code> |
|||
| 01 |
|||
| X(32) VALUE “Start WS primesgen” |
|||
| DISPLAY |
|||
| Debug WS marker |
|||
|- |
|||
| <code>file-buffer</code> |
|||
| 01 |
|||
| X(132) |
|||
| DISPLAY |
|||
| FD record area for fprinter (declared but file not opened in primesgen) |
|||
|- |
|||
| <code>printer</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Print control group (unused in primesgen; print handled by primesui) |
|||
|- |
|||
| <code>print-buffer</code> |
|||
| 03 |
|||
| X(132) |
|||
| DISPLAY |
|||
| Line buffer |
|||
|- |
|||
| <code>line-number</code> |
|||
| 03 |
|||
| 99 VALUE 99 |
|||
| DISPLAY |
|||
| Current line counter |
|||
|- |
|||
| <code>page-number</code> |
|||
| 03 |
|||
| 9(4) VALUE ZERO |
|||
| DISPLAY |
|||
| Current page counter |
|||
|- |
|||
| <code>test-quot</code> |
|||
| 01 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Quotient from DIVIDE in sieve loop |
|||
|- |
|||
| <code>primes</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Local sieve control group (mirrors primes-dal structure) |
|||
|- |
|||
| <code>gen-methods</code> |
|||
| 03 |
|||
| X(32) |
|||
| DISPLAY |
|||
| Method verb for internal DAL calls |
|||
|- |
|||
| — <code>query-process</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “query” |
|||
|- |
|||
| — <code>start-process</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “start” |
|||
|- |
|||
| — <code>next-divider</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “get” |
|||
|- |
|||
| — <code>write-prime</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “put” |
|||
|- |
|||
| — <code>stop-process</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE “stop” |
|||
|- |
|||
| <code>primes-result</code> |
|||
| 03 |
|||
| 9(2) VALUE ZERO |
|||
| DISPLAY |
|||
| Result of sieve DAL call |
|||
|- |
|||
| — <code>init-primes-ok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 1 |
|||
|- |
|||
| — <code>first-divider-ok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 2 |
|||
|- |
|||
| — <code>next-divider-ok</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 3 |
|||
|- |
|||
| <code>test-number</code> |
|||
| 03 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Current candidate being tested for primality |
|||
|- |
|||
| <code>test-number-sqr</code> |
|||
| 03 |
|||
| 9(9)V9(9) |
|||
| DISPLAY |
|||
| Square root of test-number (decimal) |
|||
|- |
|||
| <code>test-divider</code> |
|||
| 03 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Current trial divisor fetched from DB |
|||
|- |
|||
| <code>test-rest</code> |
|||
| 03 |
|||
| 9(9)V9(9) |
|||
| DISPLAY |
|||
| Remainder from DIVIDE |
|||
|- |
|||
| <code>old-test-number</code> |
|||
| 03 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| Previous test-number (diagnostic / unused) |
|||
|- |
|||
| <code>old-ident</code> |
|||
| 03 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| ident of the last divider fetched; incremented before next fetch |
|||
|- |
|||
| <code>new-ident</code> |
|||
| 03 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| old-ident + 1; used as key in SELECT to get next divider |
|||
|- |
|||
| <code>primes-ui</code> |
|||
| 01 |
|||
| (group) |
|||
| — |
|||
| COPY — see §4 |
|||
|- |
|||
| <code>primes-dal</code> |
|||
| 01 |
|||
| (group) |
|||
| — |
|||
| COPY — see §3 |
|||
|} |
|||
'''Linkage section:''' |
|||
{| |
|||
! Name |
|||
! Source |
|||
! Description |
|||
|- |
|||
| <code>primes-session</code> |
|||
| COPY primes-session |
|||
| Passed in by primesmain |
|||
|} |
|||
----- |
|||
<span id="program-primes-dal-working-storage"></span> |
|||
== 10. Program: primes (DAL) — Working Storage == |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>filler</code> |
|||
| 01 |
|||
| X(32) VALUE “Start WS primes” |
|||
| DISPLAY |
|||
| Debug WS marker |
|||
|- |
|||
| <code>DATASRC</code> |
|||
| 01 |
|||
| X(64) VALUE “pgsql://localhost:5432/primes&default_schema=primes” |
|||
| DISPLAY |
|||
| GixSQL connection string |
|||
|- |
|||
| <code>DBUSR</code> |
|||
| 01 |
|||
| X(64) VALUE “primes_user” |
|||
| DISPLAY |
|||
| Database user name |
|||
|- |
|||
| <code>DBPWD</code> |
|||
| 01 |
|||
| X(64) VALUE “pr1mes_user” |
|||
| DISPLAY |
|||
| Database password (plain-text) |
|||
|- |
|||
| <code>CUR-STEP</code> |
|||
| 01 |
|||
| X(16) |
|||
| DISPLAY |
|||
| Diagnostic: current SQL step (“CONNECT” / “DISCONNECT”) |
|||
|- |
|||
| <code>primes-row</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| FETCH target for cursor |
|||
|- |
|||
| <code>r-ident</code> |
|||
| 03 |
|||
| 9(9) |
|||
| COMP-3 |
|||
| Fetched ident value |
|||
|- |
|||
| <code>r-prime</code> |
|||
| 03 |
|||
| 9(9) |
|||
| COMP-3 |
|||
| Fetched prime value |
|||
|- |
|||
| <code>prime-count</code> |
|||
| 01 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| (Unused in current flow) |
|||
|- |
|||
| <code>prime_seq</code> |
|||
| 01 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| (Unused in current flow) |
|||
|- |
|||
| <code>divider</code> |
|||
| 01 |
|||
| 9(9) |
|||
| DISPLAY |
|||
| (Unused in current flow) |
|||
|- |
|||
| <code>primes</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Local copy of sieve control (mirrors primes-dal; used for internal paragraphs) |
|||
|- |
|||
| <code>SQLCA</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| COPY SQLCA — see §7 |
|||
|- |
|||
| <code>primes-table</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| EXEC SQL INCLUDE primes-table — see §5 |
|||
|- |
|||
| <code>primes-ui</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| COPY primes-ui — see §4 |
|||
|} |
|||
'''Linkage section:''' |
|||
{| |
|||
! Name |
|||
! Source |
|||
! Description |
|||
|- |
|||
| <code>primes-dal</code> |
|||
| COPY primes-dal |
|||
| Passed in by primesgen |
|||
|} |
|||
----- |
|||
<span id="program-primesui-working-storage"></span> |
|||
== 11. Program: primesui — Working Storage == |
|||
{| |
|||
!width="20%"| Name |
|||
!width="20%"| Level |
|||
!width="20%"| Picture |
|||
!width="20%"| Usage |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>filler</code> |
|||
| 01 |
|||
| X(32) VALUE “start ws primesui” |
|||
| DISPLAY |
|||
| Debug WS marker |
|||
|- |
|||
| <code>primes-table</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| 6-column print accumulator (OCCURS 6) |
|||
|- |
|||
| <code>primes-cel</code> |
|||
| 03 |
|||
| OCCURS 6 INDEXED primes-idx |
|||
| — |
|||
| One cell per prime entry on a print line |
|||
|- |
|||
| <code>t-ident</code> |
|||
| 05 |
|||
| Z(9) |
|||
| DISPLAY |
|||
| Sequence number, zero-suppressed |
|||
|- |
|||
| filler |
|||
| 05 |
|||
| X(2) |
|||
| DISPLAY |
|||
| Column separator spaces |
|||
|- |
|||
| <code>t-prime</code> |
|||
| 05 |
|||
| Z(9) |
|||
| DISPLAY |
|||
| Prime value, zero-suppressed |
|||
|- |
|||
| filler |
|||
| 05 |
|||
| X(2) |
|||
| DISPLAY |
|||
| Column separator spaces |
|||
|- |
|||
| <code>table-header</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Heading row (OCCURS 6) — “Sequence Prime” × 6 |
|||
|- |
|||
| <code>printer</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Print control group |
|||
|- |
|||
| <code>print-buffer</code> |
|||
| 03 |
|||
| X(132) |
|||
| DISPLAY |
|||
| Current line being built |
|||
|- |
|||
| <code>primes-prt-status</code> |
|||
| 03 |
|||
| X(2) |
|||
| DISPLAY |
|||
| File-status code for fprinter |
|||
|- |
|||
| <code>page-number</code> |
|||
| 03 |
|||
| 9(4) VALUE 1 |
|||
| DISPLAY |
|||
| Current page number |
|||
|- |
|||
| <code>print-new-page</code> |
|||
| 03 |
|||
| 9 VALUE 1 |
|||
| DISPLAY |
|||
| Flag: 1 = new page needed |
|||
|- |
|||
| — <code>new-page</code> |
|||
| 88 |
|||
| — |
|||
| — |
|||
| VALUE 1 |
|||
|- |
|||
| <code>primes-heading</code> |
|||
| 01 |
|||
| X(118) VALUE “primes overview” |
|||
| DISPLAY |
|||
| Page heading text |
|||
|- |
|||
| <code>primes-footing</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| Page footing group |
|||
|- |
|||
| filler |
|||
| 03 |
|||
| X(118) VALUE SPACE |
|||
| DISPLAY |
|||
| Left padding |
|||
|- |
|||
| filler |
|||
| 03 |
|||
| X(6) VALUE “page:” |
|||
| DISPLAY |
|||
| Label |
|||
|- |
|||
| <code>f-page-number</code> |
|||
| 03 |
|||
| Z(3)9 VALUE 1 |
|||
| DISPLAY |
|||
| Formatted page number |
|||
|- |
|||
| <code>primes-line</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| (Declared but not used in current flow) |
|||
|- |
|||
| <code>primes-total</code> |
|||
| 01 |
|||
| — |
|||
| — |
|||
| (Declared but not used in current flow) |
|||
|- |
|||
| <code>primes-count</code> |
|||
| 03 |
|||
| 9(8) |
|||
| DISPLAY |
|||
| (Declared but not used in current flow) |
|||
|} |
|||
'''Linkage section:''' |
|||
{| |
|||
! Name |
|||
! Source |
|||
! Description |
|||
|- |
|||
| <code>primes-ui</code> |
|||
| COPY primes-ui |
|||
| Passed in by all callers |
|||
|} |
|||
----- |
|||
<span id="database-objects"></span> |
|||
== 12. Database Objects == |
|||
{| |
|||
!width="20%"| Object |
|||
!width="20%"| Type |
|||
!width="20%"| Schema |
|||
!width="20%"| Owner |
|||
!width="20%"| Definition |
|||
|- |
|||
| <code>primes</code> |
|||
| Schema |
|||
| — |
|||
| primes_user |
|||
| Container schema |
|||
|- |
|||
| <code>asc_ident</code> |
|||
| Sequence |
|||
| primes |
|||
| primes_user |
|||
| INTEGER, START 1, INCREMENT 1 |
|||
|- |
|||
| <code>primes</code> |
|||
| Table |
|||
| primes |
|||
| primes_user |
|||
| See below |
|||
|- |
|||
| <code>primescursor</code> |
|||
| Cursor |
|||
| runtime |
|||
| — |
|||
| DECLARE … CURSOR FOR SELECT * FROM primes |
|||
|} |
|||
<span id="table-primes.primes"></span> |
|||
=== Table: primes.primes === |
|||
{| |
|||
!width="20%"| Column |
|||
!width="20%"| Type |
|||
!width="20%"| Nullable |
|||
!width="20%"| Default |
|||
!width="20%"| Description |
|||
|- |
|||
| <code>ident</code> |
|||
| INTEGER |
|||
| YES |
|||
| nextval(‘primes.asc_ident’) |
|||
| Auto-assigned insertion sequence |
|||
|- |
|||
| <code>prime</code> |
|||
| INTEGER |
|||
| YES |
|||
| — |
|||
| Prime number value |
|||
|} |
|||
Revision as of 22:55, 24 March 2026
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) |
SQLWARN0–SQLWARN7
|
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 |