Theo Kouwenhoven
asked on
CGI on AS400
Hi,
Some time ago I created a RPG-program that generates a web page on the AS400. (in the /QSYS.LIB/STCKLIB.LIB, so not in a folder)
This page is updated 2 times a day. Because the update time is only 2 to 3 seconds, I like to call this program with a CGI script.
I already did the following:
- I changed the output from a Source file to buffer like :
C EVAL #LINE = SRCDTA
C EVAL #LENGTH = %len(%trim(#LINE))
C CALLB 'QtmhWrStout'
C PARM #LINE
C PARM #LENGTH
C PARM #ERR
- I tried to make a CGI script from some examples, but I can not figureout how to do this.
Is there anybody who knows how to build such CGI-script and how to run it ?
Thanx.
Some time ago I created a RPG-program that generates a web page on the AS400. (in the /QSYS.LIB/STCKLIB.LIB, so not in a folder)
This page is updated 2 times a day. Because the update time is only 2 to 3 seconds, I like to call this program with a CGI script.
I already did the following:
- I changed the output from a Source file to buffer like :
C EVAL #LINE = SRCDTA
C EVAL #LENGTH = %len(%trim(#LINE))
C CALLB 'QtmhWrStout'
C PARM #LINE
C PARM #LENGTH
C PARM #ERR
- I tried to make a CGI script from some examples, but I can not figureout how to do this.
Is there anybody who knows how to build such CGI-script and how to run it ?
Thanx.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
the string "Content-type: text/html\n\n"
"\n" is the linefeed in C language. On ILE RPG/400 and ILE COBOL/400, linefeed is x'15' (hex), so you can use something like this to define it:
Dlinefeed C x'15'
For the configuration on the HTTP server side will have something like this:
Map /cgi-bin/* /cgi-bin/*.pgm
Exec /cgibin/* /qsys.lib/mylib.lib/*
where mylib will contain the CGI program.