Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pass parameters to cgi pgm

Status
Not open for further replies.

jadec

MIS
Jan 22, 2004
87
US
Hi everyone,

I'm creating a cgi pgm 'xinq01', which is called from web server :
my cgi pgm is a rpgle pgm. in the pgm i code:
Code:
 d main      pr        extpgm('XINQ01')
 d                   2
 d                  35
 d main      pi
 d  parm1            2
 d  parm2           35

but i don't get data. when i debug the pgm, I found the parm2 passed to my rpgle pgm is not right. it has a enf of file sign at position 34. Can anyone help me to fix this problem? Thank you very much!
 
You can't pass parms that way since a server CGI program is completely independant of the client web browser.

In a standard CGI program you could code like this :
Code:
      ****************************************************************
      *  Description.. Hello World Sample CGI program using RPG      *
      *  Program Name. HELLOW                                        *
      *  Author....... Bradley V. Stone                              *
      *                BVS/Tools - [URL unfurl="true"]www.bvstools.com[/URL]                  *
      *                                                              *
      * Compile Instructions:                                        *
      * 1. CRTRPGMOD MODULE(lib/HELLOW) +                            *
      *     SRCFILE(lib/QRPGLESRC) TGTRLS(V3R7M0)                    *
      *                                                              *
      * 2. CRTPGM PGM(lib/HELLOW) BNDSRVPGM(QTCP/QTMHCGI)            *
      *                                                              *
      ****************************************************************
     D WPError         DS
     D  EBytesP                1      4B 0 INZ(40)
     D  EBytesA                5      8B 0
     D  EMsgID                 9     15
     D  EReserverd            16     16
     D  EData                 17     56
      *
     D HTTPHeader      C                   CONST('Content-type: text/html')
     D NewLine         C                   CONST(X'15')
      *
     D WrtDta          S           1024
     D WrtDtaLen       S              9B 0
      ****************************************************************
     C                   EXSR      $Main
      *
     C                   eval      *INLR = *On
      ****************************************************************
      *
      ****************************************************************
     C     $Main         BEGSR
      *
     C                   eval      WrtDta = '<html><head>' +
     C                                      '<title>Hello World</title>' +
     C                                      '</head><body>' +
     C                                      'Hello World!' +
     C                                      '</body></html>' +
     C                                      NewLine
     C                   EXSR      $WrStout
      *
     C                   ENDSR
      ****************************************************************
      *
      ****************************************************************
     C     $WrStout      BEGSR
      *
     C     ' '           CHECKR    WrtDta:1024   WrtDtaLen
      *
     C                   CALLB     'QtmhWrStout'
     C                   PARM                    WrtDta
     C                   PARM                    WrtDtaLen
     C                   PARM                    WPError
      *
     C                   ENDSR
      ****************************************************************
      *
      ****************************************************************
     C     *INZSR        BEGSR
      *
     C                   eval      WrtDta = %trim(HTTPHeader) +
     C                                      NewLine + NewLine
     C                   EXSR      $WrStout
      *
     C                   ENDSR

However you'd better use the CGIDEV2 library available free of charge from IBM at IMO, it's the easiest way for you to develop Web applications.
 
Hi Talkturkey,

Thank you for the reply. We use I-Net software as interface to call cgi program from web server. I found the parameter length cannot be longer than 33. But Thank you for the IBM link, I'm just thinking to learn ibm CGI technigue.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top