Difference between revisions of "Primes"
(Created page with "The subprograms are in fact object, containing methods and data. = Program structure = The program consists of a main program and three subprograms. The main program primesm...") |
|||
| Line 1: | Line 1: | ||
| − | The subprograms are in fact |
+ | The primes program is purely for demonstration purposes, it would be nonsensical to generate primes and retrieve the dividers from a database. The subprograms are in fact objects, containing methods and data. |
= Program structure = |
= Program structure = |
||
| − | The program consists of a main program and three subprograms. The main program [[primesmain.cbl]] is invoked by the command 'primesmain report'. |
+ | The program consists of a main program and three subprograms. The main program [[primesmain.cbl]] is invoked by the command 'primesmain report'. The subprograms implementing the objects and methods are: |
| + | * primesui, providing the user interface as a print file |
||
| − | The sample program [[pgcobol.cbl]] makes use of the sample database: employee. When executed pgcobol puts out the file [[pgcobol.prt]].<br /> |
||
| + | * primesgen, manages the proces of primes generation and reporting, it does the prime determination too. |
||
| − | The pgcobol program file is available for download here: [https://wiki.webhuis.nl/images/pgcobol.cbl pgcobol.cbl ]. |
||
| + | * primes |
||
| + | Only the primes program makes use of the PostgreSQL database and so a good demonstration of three tier design. |
||
| + | == primesmain == |
||
| + | The program source code file is available for download here: [https://wiki.webhuis.nl/images/primesmain.cbl primesmain.cbl ]. When executed primesmain puts out the file [[primes.prt]].<br /> |
||
| + | The program only needs a cobol compile process, which is as follows: |
||
| + | <pre> |
||
| + | /usr/bin/cobc -x primesmain.cbl -T primesmain.out |
||
| + | </pre> |
||
| + | This results in the executable program file '''primesmain''' and the compilation listing [[pgcobol.out]]. |
||
| + | == primesgen == |
||
| + | The program source code file is available for download here: [https://wiki.webhuis.nl/images/primesgen.cbl primesgen.cbl ]. The program has to be compiled as a module or a subprogram, it cannot be executed directly.<br /> |
||
| + | The program only needs a cobol compile process, which is as follows: |
||
| + | <pre> |
||
| + | /usr/bin/cobc -x primesgen.cbl -T primesgen.out |
||
| + | </pre> |
||
| + | This results in the program module file '''primesgen.so''' and the compilation listing [[primesgen.out]]. |
||
== Sample database == |
== Sample database == |
||
Revision as of 21:18, 9 December 2025
The primes program is purely for demonstration purposes, it would be nonsensical to generate primes and retrieve the dividers from a database. The subprograms are in fact objects, containing methods and data.
Contents
Program structure
The program consists of a main program and three subprograms. The main program primesmain.cbl is invoked by the command 'primesmain report'. The subprograms implementing the objects and methods are:
- primesui, providing the user interface as a print file
- primesgen, manages the proces of primes generation and reporting, it does the prime determination too.
- primes
Only the primes program makes use of the PostgreSQL database and so a good demonstration of three tier design.
primesmain
The program source code file is available for download here: primesmain.cbl . When executed primesmain puts out the file primes.prt.
The program only needs a cobol compile process, which is as follows:
/usr/bin/cobc -x primesmain.cbl -T primesmain.out
This results in the executable program file primesmain and the compilation listing pgcobol.out.
primesgen
The program source code file is available for download here: primesgen.cbl . The program has to be compiled as a module or a subprogram, it cannot be executed directly.
The program only needs a cobol compile process, which is as follows:
/usr/bin/cobc -x primesgen.cbl -T primesgen.out
This results in the program module file primesgen.so and the compilation listing primesgen.out.
Sample database
The employee database is a very simple database, with one table containing three lines. The pg_dump file is in the link.
The cobc GNUCobol compilation
The command invoking the precompile process is as follows:
/usr/bin/cobc -x pgcobol.cbsql -l:libgixsql.so -T pgcobol.out
This results in the executable program file pgcobol and the compilation listing pgcobol.out.
Back to: voorpagina