Learn from sources
       Member RANDOMNBRS in CGIDEV2 / QRPGLESRC

       **************************************************************************
       * This material is provided by IBM for illustrative purposes             *
       * only and has not been thoroughly tested under all conditions.          *
       * IBM, therefore, cannot guarantee or imply reliability,                 *
       * serviceability, or function of this material.  IBM provides            *
       * no program services for this material.  All material contained         *
       * herein is provided to you "AS IS" without any warranties of            *
       * any kind.  THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS          *
       * FOR A PARTICULAR PURPOSE AND NON-INFRINGMENT ARE EXPRESSLY             *
       * DISCLAIMED.  SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION             *
       * OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSIONS MAY NOT APPLY           *
       * TO YOU.  IN NO EVENT WILL IBM BE LIABLE TO ANY PARTY FOR ANY           *
       * DIRECT, INDIRECT, SPECIAL OR OTHER CONSEQUENTIAL DAMAGES FOR           *
       * ANY USE OF THIS MATERIAL, INCLUDING, WITHOUT LIMITATION, ANY           *
       * LOST PROFITS, BUSINESS INTERRUPTION, LOSS OF PROGRAMS OR OTHER         *
       * DATA ON YOUR INFORMATION HANDLING SYSTEM OR OTHERWISE, EVEN            *
       * IF WE ARE EXPRESSLY ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.        *
       *                                                                        *
       * (C) Copyright IBM Corp. 1997, 2005                                     *
       * All rights reserved.                                                   *
       * US Government Users Restricted Rights -                                *
       * Use, duplication, or disclosure restricted                             *
       * by GSA ADP Schedule Contract with IBM Corp.                            *
       *                                                                        *
       * Licensed Materials - Property of IBM                                   *
       **************************************************************************
       /copy qrpglesrc,hspecs
       /copy qrpglesrc,hspecsbnd
 
       * Prototype and interface for this program
      D RandomNbrs      pr
      D  Stmf                        512
      D  CodePage                      5p 0
      D  Low                          10p 0
      D  High                         10p 0
      D  Rows                          5p 0
      D  Cols                          5p 0
 
      D RandomNbrs      pi
      D  Stmf                        512
      D  CodePage                      5p 0
      D  Low                          10p 0
      D  High                         10p 0
      D  Rows                          5p 0
      D  Cols                          5p 0
 
      D  CodePageU0     s             10u 0
 
       * Prototype defintions and standard system API error structure
       /copy cgidev2/qrpglesrc,prototypeb
       /copy cgidev2/qrpglesrc,usec
 
       * Last updated information
      D LastDate        s               d   datfmt(*iso)
      D LastTime        s               t   timfmt(*hms)
       * Return code
      D rc              s             10i 0
       * Loop control variables
      D i               s             10i 0
      D j               s             10i 0
       ****************************************************************************
       * Mainline
       ****************************************************************************
       * Turn all debugging off
      C*                  callp     SetNoDebug(*on)
       * Convert CodePage to the format needed for subprocedure WrtHtmlStmf()
      C                   eval      codepageU0=codepage
       * Get current date and time
      C                   time                    LastDate
      C                   time                    LastTime
       * Read externally defined output html
 cccccC                   callp     gethtml('HTMLSRC':'CGIDEV2':'RANDOMNBRS':
 cccccC                             '«AS400»')
       * Update html variables for top of page
      C                   callp     UpdHtmlVar('LastUpdated':
      C                             %char(LastDate) + ' at ' + %char(LastTime))
      C                   callp     UpdHtmlVar('rows':%trim(%editc(rows:'Z')))
      C                   callp     UpdHtmlVar('cols':%trim(%editc(cols:'Z')))
      C                   callp     UpdHtmlVar('count':%trim(
      C                             %editc(rows*cols:'Z')))
      C                   callp     UpdHtmlVar('low':%trim(%editc(low:'Z')))
      C                   callp     UpdHtmlVar('high':%trim(%editc(high:'Z')))
       * Build HTML
      C                   callp     WrtSection('Top')
      C                   do        rows          i
      C                   callp     WrtSection('tablerow')
      C                   do        cols          j
      C                   callp     UpdHtmlVar('data':
      C                             %trim(%editc(random(low:high):'Z')))
      C                   callp     WrtSection('TableData')
      C                   enddo
      C                   callp     WrtSection('endtablerow')
      C                   enddo
      C                   callp     WrtSection('EndHtml')
       * Send HTML to stream file
      C                   if        codepage » 0
      C                   eval      rc = WrtHtmlToStmf(%trim(Stmf):CodePageU0)
      C                   else
      C                   eval      rc = WrtHtmlToStmf(%trim(Stmf))
      C                   endif
       * Exit
      C                   return
0.041 sec.s