Editing
Program Logic
(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!
== 4. primesui β Step-by-Step Logic == '''Source:''' <code>primesui.cbl</code><br /> '''Role:''' All output. Manages the <code>primes.prt</code> print file and writes to the system console. <span id="procedure-division-1"></span> === PROCEDURE DIVISION === <pre>EVALUATE TRUE on ui-methods WHEN start-ui β PERFORM r90-start-primesui WHEN write-ui β PERFORM r92-write-primesui WHEN stop-ui β PERFORM r99-stop-primesui WHEN message-ui β PERFORM r98-message-ui WHEN OTHER β ui-method-result = 1 EXIT PROGRAM</pre> <span id="paragraph-r90-start-primesui"></span> === 4.1 Paragraph: r90-start-primesui === <pre>MOVE 'start-primesui' TO program-paragraph MOVE 'start-printer' TO program-message OPEN OUTPUT fprinter (primes.prt) IF primes-prt-status = '00' THEN ui-method-result = 0 SET primes-idx TO 1 β initialise table column index LOG "Open printer Ok" ELSE ui-method-result = 1 DISPLAY primes-prt-status on console</pre> <span id="paragraph-r92-write-primesui-called-for-every-prime-row"></span> === 4.2 Paragraph: r92-write-primesui ''(called for every prime row)'' === <pre>t-ident(primes-idx) = u-sequence β load sequence into current cell t-prime(primes-idx) = u-number β load prime value into current cell SET primes-idx UP BY 1 β advance to next cell IF new-page (print-new-page = 1) THEN PERFORM r93-new-page β write heading + column header IF primes-idx = 7 THEN β 6 entries filled (index is post-increment) MOVE primes-table TO print-buffer WRITE file-buffer FROM print-buffer β write the 132-char data line SET primes-idx TO 1 IF linage-counter = 53 THEN β within 3 lines of page end PERFORM r94-eop</pre> <span id="paragraph-r93-new-page"></span> === 4.3 Paragraph: r93-new-page === <pre>MOVE primes-heading TO print-buffer WRITE file-buffer FROM print-buffer β "primes overview" MOVE table-header TO print-buffer WRITE file-buffer FROM print-buffer β "Sequence Prime " Γ 6 MOVE ZERO TO print-new-page β clear new-page flag</pre> <span id="paragraph-r94-eop-end-of-page"></span> === 4.4 Paragraph: r94-eop ''(end-of-page)'' === <pre>MOVE page-number TO f-page-number MOVE ' ' TO print-buffer WRITE file-buffer FROM print-buffer β blank separator line MOVE primes-footing TO print-buffer WRITE file-buffer FROM print-buffer β " page: NNN" ADD 1 TO page-number MOVE 1 TO print-new-page β trigger new heading on next write</pre> <span id="paragraph-r98-message-ui"></span> === 4.5 Paragraph: r98-message-ui === <pre>DISPLAY process-message UPON scherm β writes program-name + paragraph + message to console</pre> <span id="paragraph-r99-stop-primesui"></span> === 4.6 Paragraph: r99-stop-primesui === <pre>MOVE 0 TO u-sequence MOVE 0 TO u-number PERFORM r92-write-primesui UNTIL new-page β pad remaining cells to trigger line flush MOVE 'stop-primesui' TO program-paragraph MOVE 'close printer' TO program-message PERFORM r98-message-ui CLOSE fprinter MOVE primes-prt-status TO ui-method-result IF primes-prt-status = '00' THEN next sentence ELSE DISPLAY primes-prt-status on console</pre> <hr/> Terug naar: [[Primes_programs_specifications]] | [[Cobol and PostgreSQL]]
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