Learn from sources
       Member LAB22B in CGI400C2 / QRPGLESRC

       *********************************************************************
       *  RPG ILE MODULE CGI400C2/LAB22B
       *  This is the same as LAB22A,
       *  except that it loads a different external HTML
       *
       *  After compiling this RPG MODULE,
       *  create the related program with the following command:
       *
       *  CRTPGM CGI400C2/LAB22B MODULE(CGI400C2/LAB22B)
       *         ACTGRP(CGI) AUT(*USE)
       *
       *********************************************************************
       /copy CGI400C2/qrpglesrc,hspecs
       /copy CGI400C2/qrpglesrc,hspecsbnd
      FBCT01A    IF   e           K DISK    USROPN
       *=====================================================================
       * Includes to be used in all CGIs
       *=====================================================================
       /copy CGI400C2/qrpglesrc,prototypeb
       /copy CGI400C2/qrpglesrc,usec
       /copy CGI400C2/qrpglesrc,variables3
       *=====================================================================
       *  Variables specific to this program
       *=====================================================================
      D Lng             s              2a
      D OpenSW          s              1a
      D Char500         s            500a
       *=====================================================================
       * Main line
       *=====================================================================
       * This CGI expects no input from the remote browser:
       *  therefore the following two statements are not really needed
       /copy CGI400C2/qrpglesrc,prolog3
      C                   eval      lng      = zhbgetvar('lng')
       * Ask the service program to load into core
       * the appropriate external html
       * (Note that if this loading was already performed,
       *  and the external html was not changed,
       *  the service program will ignore the load request,
       *  thus providing a significant response time improvement)
      C                   callp     gethtml('HTMLSRC':
      C                             'CGI400C2':
      C                             'LAB22B')
       *------------------
       * Provide the bookshelves list
      C                   exsr      List
       * Flush the html buffer and exit
      C                   exsr      Exit
       *=====================================================================
       * Provide the bookshelves list
       *=====================================================================
      C     List          begsr
       * Override and open file (if the first time through)
      C                   exsr      OpenDbf
      C                   callp     wrtsection('top')
       * Start table
      C                   callp     wrtsection('tabstr')
       *------------------
       * Position to the beginning of the file
      C                   eval      Bct01Des = *loval
      C     Bct01Des      setll     bct01rcd
       * Read loop
      C                   read      bct01rcd
      C                   dow       not %eof
      C                   exsr      SetTabRow
      C                   callp     wrtsection('tabrow')
      C                   read      bct01rcd
      C                   enddo
       *------------------
       * End table
      C                   callp     wrtsection('tabend')
       * Leave the file opened, to save time on the next CGI request
      C                   endsr
       *=====================================================================
       * Set variables in html section "tabrow"
       *=====================================================================
      C     SetTabRow     begsr
       * Bookshelf description
      C                   callp     updHtmlVar('XBCT01DES':Bct01Des)
       * Bookshelf identifier (unedited)
      C                   movel(p)  Bct01Nbr      Char500
      C                   callp     updHtmlVar('XBCT01NBR':Char500)
       *
      C                   endsr
       *=====================================================================
       * Override and open file (if the first time through)
       *=====================================================================
      C     OpenDbf       begsr
      C                   IF        OpenSW = ' '
      C                   eval      OpenSW = 'x'
      C                   eval      rc = docmd('OVRDBF FILE(BCT01A) +
      C                             TOFILE(CENTAUR2/BCT01A) +
      C                             SECURE(*YES)')
      C                   open      BCT01A
      C                   ENDIF
      C                   endsr
       *=====================================================================
       * Send response html and return
       *=====================================================================
      C     Exit          begsr
       * End html
      C                   callp     wrtsection('end')
       * Do not delete the call to wrtsection with section name *fini.  It is needed
       * to ensure that all output html that has been buffered gets output.
      C                   callp     wrtsection('*fini')
       * Return without raising LR indicator:
       * this will provide enhanced response time on the next request
       * for this CGI
      C                   return
      C                   endsr
0.018 sec.s