Member BREAKFAST in CGICBLDEV2 / QCBLLESRC

1.00 
 ********START OF PGM : BREAKFAST  ****************************************
2.00 
       *================================================================
3.00 
       *
4.00 
       *  After compiling this module, create the program as follow:
5.00 
       *
6.00 
       *  CRTPGM  PGM(CGICBLDEV2/BREAKFAST) MODULE(CGICBLDEV2/BREAKFAST)
7.00 
       *          BNDDIR(CGICBLDEV2/CGICBLDEV2)
8.00 
       *          ACTGRP(BREAKFAST) AUT(*USE)
9.00 
       *
10.00 
       *================================================================
11.00 
        PROCESS NOXREF APOST
12.00 
        ID    DIVISION.
13.00 
        PROGRAM-ID. BREAKFAST.
14.00 
        ENVIRONMENT DIVISION.
15.00 
        CONFIGURATION SECTION.
16.00 
        SPECIAL-NAMES.
17.00 
              copy CPYSPCNAME of CGICBLDEV2-QCBLLESRC.
18.00 
        INPUT-OUTPUT SECTION.
19.00 
        FILE-CONTROL.
20.00 
       *----------------------------------
21.00 
            SELECT breakfast1
22.00 
                   ASSIGN       TO         DATABASE-breakfast1
23.00 
                   ORGANIZATION IS         INDEXED
24.00 
                   ACCESS       IS         DYNAMIC
25.00 
                   RECORD KEY   IS         EXTERNALLY-DESCRIBED-KEY
26.00 
                   FILE STATUS  IS         STATUS-breakfast1.
27.00 
       *----------------------------------
28.00 
        DATA DIVISION.
29.00 
        FILE SECTION.
30.00 
       *----------------------------------
31.00 
        FD  breakfast1
32.00 
                                           LABEL RECORD IS STANDARD.
33.00 
        01  breakfast1-RECFD.
34.00 
            COPY DDS-ALL-FORMAT   OF breakfast1.
35.00 
       *=================================================================
36.00 
        WORKING-STORAGE SECTION.
37.00 
       *=================================================================
38.00 
       *       ----- Variables specific to this program ------
39.00 
       *
40.00 
        01         HTML-DATA.
41.00 
       * General purpose indicator
42.00 
            05     myindic             PIC  1.
43.00 
       * Variables to execute a command
44.00 
            05     rc                  PIC  S9(9) comp-4.
45.00 
            05     cmd                 PIC  X(2000).
46.00 
       * Variables to parse the input string
47.00 
            05     varnamein           PIC  X(50).
48.00 
            05     xbftid              PIC  X(1000).
49.00 
       * Variables to load external HTML
50.00 
            05     fn                  PIC  X(10) VALUE 'HTMLEXAMPL'.
51.00 
            05     lib                 PIC  X(10) VALUE 'CGICBLDEV2'.
52.00 
            05     mbr                 PIC  X(10) VALUE 'BREAKFAST'.
53.00 
       * Variable for QWrtSection subprocedure
54.00 
            05     HtmlSects           PIC  X(1000).
55.00 
       * Variables for QUpdHtmlVar subprocedure
56.00 
            05     varnameout          PIC  X(30).
57.00 
            05     varvalout           PIC  X(1000).
58.00 
       * Miscellaneous variables
59.00 
        01         MISC-DATA.
60.00 
            05     xbftdes             PIC  X(50).
61.00 
            05     wkf                 PIC  X(01).
62.00 
            05     openSW              PIC  X(01).
63.00 
       * Status field
64.00 
            05     status-breakfast1       PIC  X(02).
65.00 
       *=================================================================
66.00 
       *                M A I N  -  L I N E
67.00 
       *=================================================================
68.00 
        PROCEDURE DIVISION.
69.00 
        A-start-pgm.
70.00 
            move '1' to myindic.
71.00 
            move ' ' to xbftdes.
72.00 
            perform OpenFiles              thru z-OpenFiles.
73.00 
            perform GetCGIInput            thru z-GetCGIInput.
74.00 
            perform LoadHtml               thru z-LoadHtml.
75.00 
            perform SendHtml               thru z-SendHtml.
76.00 
       *----------------------------------
77.00 
        B-end-pgm.
78.00 
            exit program and continue run unit.
79.00 
       *=================================================================
80.00 
        GetCGIInput.
81.00 
       * Get input data from POST or GET
82.00 
            call 'QZHBGETINPUT'.
83.00 
       * Parse input string into program field 'xbftid':
84.00 
            move 'xbftid' to varnamein.
85.00 
            call 'QZHBGETVAR' using
86.00 
                              by content varnamein
87.00 
                              returning into xbftid.
88.00 
       *----------------------------------
89.00 
        z-GetCGIInput.
90.00 
            EXIT.
91.00 
       *=================================================================
92.00 
        LoadHtml.
93.00 
       * Load html skeleton source member
94.00 
            call 'QGETHTML' using fn lib mbr.
95.00 
       *----------------------------------
96.00 
        z-LoadHtml.
97.00 
            EXIT.
98.00 
       *=================================================================
99.00 
        SendHtml.
100.00 
       *Send section /$top
101.00 
            move 'top' to HtmlSects
102.00 
            call 'QWRTSECTION' using HtmlSects.
103.00 
       *Populate the selection list
104.00 
            perform PopSltLst through z-PopSltLst.
105.00 
       *Send section 'link' (only after a selection)
106.00 
            if xbftid not= ' '
107.00 
               move 'xbftid' to varnameout
108.00 
               move xbftid to varvalout
109.00 
               call 'QUPDHTMLVAR' using varnameout varvalout
110.00 
               move 'xbftdes' to varnameout
111.00 
               move xbftdes to varvalout
112.00 
               call 'QUPDHTMLVAR' using varnameout varvalout
113.00 
               move 'link' to HtmlSects
114.00 
               call 'QWRTSECTION' using  HtmlSects
115.00 
            end-if.
116.00 
       *Write section 'end' and send the output buffer
117.00 
            move 'end *fini' to HtmlSects
118.00 
            call 'QWRTSECTION' using HtmlSects.
119.00 
       *----------------------------------
120.00 
        z-SendHtml.
121.00 
            EXIT.
122.00 
       *=================================================================
123.00 
        PopSltLst.
124.00 
       *Write section 'sltlst'
125.00 
            move 'sltlst' to HtmlSects
126.00 
            call 'QWRTSECTION' using HtmlSects.
127.00 
       *Populate the selection list
128.00 
            perform WriteRow thru z-WriteRow
129.00 
                    until status-breakfast1 not = '00'.                        60
130.00 
       *Send section 'sltend'
131.00 
            move 'sltend' to HtmlSects
132.00 
            call 'QWRTSECTION' using HtmlSects.
133.00 
       *----------------------------------
134.00 
        z-PopSltLst.
135.00 
            EXIT.
136.00 
       *=================================================================
137.00 
        WriteRow.
138.00 
            read breakfast1 next record
139.00 
            at end
140.00 
                  move wkf to wkf.
141.00 
            if status-breakfast1 = '00'
142.00 
               perform SetSltRow thru z-SetSltRow
143.00 
               move 'sltrow' to HtmlSects
144.00 
            call 'QWRTSECTION' using HtmlSects
145.00 
            end-if.
146.00 
       *----------------------------------
147.00 
        z-WriteRow.
148.00 
            EXIT.
149.00 
       *=================================================================
150.00 
        SetSltRow.
151.00 
       * Set HTML output variables
152.00 
       * for section "sltrow"
153.00 
       *==================================
154.00 
       * Set output variable /%bftid%/
155.00 
            move 'bftid' to varnameout
156.00 
            move bftid to varvalout
157.00 
            call 'QUPDHTMLVAR' using varnameout varvalout.
158.00 
       * Set output variable /%bftdes%/
159.00 
            move 'bftdes' to varnameout
160.00 
            move bftdes to varvalout
161.00 
            call 'QUPDHTMLVAR' using varnameout varvalout.
162.00 
       * Set output variable /%selected%/
163.00 
            move 'selected' to varnameout
164.00 
            if bftid = xbftid
165.00 
               move bftdes to xbftdes
166.00 
               move 'selected' to varvalout
167.00 
            else
168.00 
               move ' ' to varvalout
169.00 
            end-if.
170.00 
            call 'QUPDHTMLVAR' using varnameout varvalout.
171.00 
       *----------------------------------
172.00 
        z-SetSltRow.
173.00 
            EXIT.
174.00 
       *=================================================================
175.00 
        OpenFiles.
176.00 
            if openSW = ' '
177.00 
              move 'ovrdbf breakfast1 cgicbldev2/breakfast1 secure(*yes)'
178.00 
                   to cmd
179.00 
              call 'QDOCMD' using cmd
180.00 
                            returning into rc
181.00 
              open input breakfast1
182.00 
              move 'x' to openSW
183.00 
            else
184.00 
               move ' ' to bftdes
185.00 
               start breakfast1 key is >= externally-described-key
186.00 
            end-if.
187.00 
       *----------------------------------
188.00 
        Z-OpenFiles.
189.00 
            EXIT.
190.00 
 ********* END OF PGM : BREAKFAST ****************************************
0.059 sec.s