Editing
Business-Requirements
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== 3. Functional Requirements == <span id="fr-01-prime-generation"></span> === FR-01 β Prime Generation === {| !width="50%"| ID !width="50%"| Requirement |- | FR-01-a | The system shall accept a <code>generate</code> command-line argument to trigger prime-number generation. |- | FR-01-b | The system shall test every odd integer from 3 upward for primality using trial division. |- | FR-01-c | The system shall store each confirmed prime in the database in ascending order of discovery. |- | FR-01-d | Generation shall continue until the candidate number reaches 999,999,999. |} <blockquote>β '''Defect T1:''' The PERFORM that invokes the sieve loop is commented out in <code>primesmain.cbl</code> line 51. This requirement is '''not currently met''' by the shipped source. See [[Technical-Specification#7-known-technical-issues|Technical Specification β Defect Register]]. </blockquote> ----- <span id="fr-02-trial-division-algorithm"></span> === FR-02 β Trial-Division Algorithm === {| !width="50%"| ID !width="50%"| Requirement |- | FR-02-a | For each candidate number N, the system shall divide N by each known prime p where p β€ βN. |- | FR-02-b | If any p divides N exactly (remainder = 0), N is composite and shall not be stored. |- | FR-02-c | If no such p exists, N is confirmed prime and shall be persisted. |- | FR-02-d | Trial divisors shall be read from the database in identity sequence order. |} The algorithm implementation lives in <code>primesgen.cbl</code> paragraphs <code>r80-test-number</code> through <code>r89-get-next-divider</code>. See [[Flow-Diagrams#3-prime-generation-sieve-loop|Flow Diagrams β Sieve Loop]]. ----- <span id="fr-03-prime-reporting"></span> === FR-03 β Prime Reporting === {| !width="50%"| ID !width="50%"| Requirement |- | FR-03-a | The system shall accept a <code>report</code> command-line argument to trigger report generation. |- | FR-03-b | The system shall read all stored primes from the database in sequence order. |- | FR-03-c | The system shall write a paginated, formatted print file containing all stored primes. |} The report loop lives in <code>primesgen.cbl</code> paragraphs <code>r90-start-primes-report</code> and <code>r86-report-primes</code>. See [[Flow-Diagrams#4-prime-report-loop|Flow Diagrams β Report Loop]]. ----- <span id="fr-04-print-report-format"></span> === FR-04 β Print Report Format === {| !width="50%"| ID !width="50%"| Requirement |- | FR-04-a | The report shall carry the heading <code>"primes overview"</code> on every page. |- | FR-04-b | A column header row (<code>"Sequence Prime"</code> Γ 6) shall follow the heading on every page. |- | FR-04-c | Each data line shall display '''six''' prime entries side by side β sequence number and prime value. |- | FR-04-d | Each page shall carry a right-aligned page-number footer (<code>page: ZZZZ9</code>). |- | FR-04-e | The print record width shall be exactly '''132 characters'''. |- | FR-04-f | The print file shall be named <code>primes.prt</code> and written to the working directory. |} Print formatting is implemented entirely in <code>primesui.cbl</code>. See [[Technical-Specification#6-file-io-specification|Technical Specification β File I/O Specification]] for the full record layout. '''Print record layout (one data line):''' <pre>ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β Z(9) sp sp β Z(9) sp sp β Z(9) sp sp β Z(9) sp sp β Z(9) sp sp β Z(9) sp sp β β seq 1 β prime 1 β seq 2 β prime 2 β seq 3 β prime 3 β β¦ Γ 6 β 11 chars β 11 chars β 11 chars β 11 chars β 11 chars β 11 chars β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Each cell = 9 (value) + 2 (separator) = 11 chars Γ 6 entries = 66 chars of data + 66 chars padding = 132 total</pre> <blockquote>Each cell in <code>primesui</code> is actually <code>Z(9) + X(2) + Z(9) + X(2)</code> = 22 chars Γ 6 = 132. </blockquote> ----- <span id="fr-05-operational-logging"></span> === FR-05 β Operational Logging === {| !width="50%"| ID !width="50%"| Requirement |- | FR-05-a | The system shall write progress and status messages to the system console throughout execution. |- | FR-05-b | Each structured message shall identify the issuing '''program name''' and '''paragraph name'''. |- | FR-05-c | Significant events shall be logged: session start/stop, DB connect/disconnect, cursor open, first fetch, fetch errors, print file open/close. |} Logging is routed through <code>primesui</code> paragraph <code>r98-message-ui</code> using the <code>process-message</code> group in [[Data-Dictionary#13-primes-ui|<code>primes-ui</code>]]. ----- <span id="fr-06-error-handling"></span> === FR-06 β Error Handling === {| !width="50%"| ID !width="50%"| Requirement |- | FR-06-a | An unrecognised command-line argument shall cause the system to log an error and stop cleanly. |- | FR-06-b | Failure to open the print file shall cause the system to log an error and stop. |- | FR-06-c | A database connection failure shall cause the system to log an error and set <code>session-result = 1</code>. |- | FR-06-d | A cursor open failure shall cause the system to log an error and set <code>session-result = 1</code>. |- | FR-06-e | A fetch failure shall cause the system to log an error and terminate the fetch loop. |} ----- <span id="non-functional-requirements"></span>
Summary:
Please note that all contributions to Webhuis wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see
Project:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Voorpagina
Cobol and PostgreSQL
PostgreSQL
CFEngine
Proxmox
Webhuis Kennisbank
Basale infra
Webhuis bouwstenen
Webhuis configuratie
Webhuis Infra
Webhuis Support
Webhuis Raspberry
Opzet Applicaties
Business Applicaties
Community portal
Current events
Recent changes
Random page
Help
sitesupport
Tools
What links here
Related changes
Special pages
Page information