Primes: Difference between revisions
| (2 intermediate revisions by the same user not shown) | |||
| Line 5: | Line 5: | ||
* primesgen, manages the proces of primes generation and reporting, it does the prime determination too. |
* primesgen, manages the proces of primes generation and reporting, it does the prime determination too. |
||
* primes |
* primes |
||
Only the primes program makes use of the PostgreSQL database and so a good demonstration of three tier design. |
Only the primes program makes use of the PostgreSQL [[primes.sql]] database and so a good demonstration of three tier design. The database dump file is available for download here: [https://wiki.webhuis.nl/images/primes.sql primes.sql ]. |
||
== primesmain == |
== 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 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 /> |
||
Latest revision as of 22:46, 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.
Program structure[edit]
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 primes.sql database and so a good demonstration of three tier design. The database dump file is available for download here: primes.sql .
primesmain[edit]
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 primesmain.out.
primesgen[edit]
The primesgen program primesgen.cbl is the program responsible for all the logic involved in the primes system. 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 -m primesgen.cbl -T primesgen.out
This results in the program module file primesgen.so and the compilation listing primesgen.out.
primesui[edit]
The primes program primesui.cbl is the program responsible for all the user interactions. The program source code file is available for download here: primesui.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 -m primesui.cbl -T primesui.out
This results in the program module file primesui.so and the compilation listing primesui.out.
primes[edit]
The primes program primes.cbl is the program responsible for all the database interactions. The program source code file is available for download here: primes.cbl . The program has to be compiled as a module or a subprogram, it cannot be executed directly.
The program needs a precompile process, which is as follows:
/usr/bin/gixsql primes.cbl primes.cbsql -S -I . -e ".,*.cpy,*.CPY"
This results in the cobol program file primes.cbsql primes.cbsql.
The next steps is the cobol compilation itself:
/usr/bin/cobc -m primes.cbsql -l:libgixsql.so -T primes.out
This results in the program module file primes.so and the compilation listing primes.out.
Back to: Cobol and PostgreSQL