Solved

CGI on AS400

Posted on 2002-04-22
2
794 Views
Last Modified: 2013-11-18
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.
0
Comment
Question by:theo kouwenhoven
2 Comments
 

Expert Comment

by:zyassine
ID: 7037534
To use CGI, the first thing to send to StdOut should be
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.

0
 

Accepted Solution

by:
Journeyman earned 100 total points
ID: 7453601
I have used an excellent free tool for creating CGI programs on my AS/400.  If you go to www-922.ibm.com/en you will find CGIDEV2.  It's essentially a server program with functions that allow you to dynamically write HTML pages based on user-created templates.  It's fairly straightforward and easy to understand by examining the provides examples.  I originally used it to create page-at-a-time web pages to display system reports.  I had a good prototype up and running in 2 or 3 days and I had virtually no HTML experience and zero CGI programming experience before that.  I think it will be worth the time to check it out.

Good luck.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question