Editing
Flow-Diagrams
(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. Prime Report β Cursor Loop == '''Program:''' <code>primesgen.cbl</code> (r86, r90, r94) + <code>primes.cbl</code> (s01, s02)<br /> '''What it shows:''' How the report path opens a cursor over the database, fetches rows one at a time, and sends each to the print buffer. <pre class="mermaid">flowchart TD A([r90-start-primes-report]) --> B[CALL primes 'connect'\ndal-methods = 'connect'] B --> C{dal-method-ok?} C -->|No| FAIL1([LOG 'Database init failed.'\nsession-result = 1\nGOTO close]) C -->|Yes| D[LOG 'Database initialisation succeeded.'\nCALL primes 'cursor'\ndal-methods = 'cursor'] D --> E[s01-cursor:\nEXEC SQL START TRANSACTION\nEXEC SQL OPEN primescursor] E --> F{dal-method-ok?} F -->|No| FAIL2([LOG 'Cursor init failed.'\nsession-result = 1\nGOTO close]) F -->|Yes| G[LOG 'Cursor initialisation succeeded.'\nr94-fetch β CALL primes 'next-prime'\nFETCH primescursor INTO primes-row] G --> H{dal-method-ok?} H -->|No| FAIL3([LOG 'Fetch first row nok.'\ndal-result = 1\nGOTO close]) H -->|Yes| I[LOG 'Fetch first row ok.'\ndal-result = 0] I --> LOOP{session-method-eof?} LOOP -->|Yes| CLOSE[r99-close-primes\nCALL primes 'disconnect'] CLOSE --> END([EXIT PROGRAM]) LOOP -->|No| WRITE[r86-report-primes\nMOVE primes-data TO u-primes\nCALL primesui 'write'] WRITE --> FETCH[r94-fetch\nCALL primes 'next-prime'\nFETCH primescursor INTO primes-row] FETCH --> FCHECK{dal-method-ok?} FCHECK -->|Yes| LOOP FCHECK -->|No| ERR[LOG 'Fetch failed.'\nsession-result = 1] ERR --> LOOP</pre> <blockquote>β οΈ <code>session-result = 1</code> (nok) is set on fetch failure, but the loop condition tests <code>session-method-eof</code> (value 9). These values do not match β the loop will continue rather than exit cleanly on cursor exhaustion. See [[Technical-Specification#7-known-technical-issues|Technical Specification β Defect T7]]. </blockquote> ----- <span id="dal-primes.cbl-method-dispatch"></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