Solved

CGI on AS400

Posted on 2002-04-22
2
811 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

Title # Comments Views Activity
WCAG (Web Content Accessibility Guidelines) levels 3 145
AS400 BRMS - none enrolled tape 6 109
removing a class in javascript 4 97
Passing client data from form to server 5 56
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
The viewer will learn how to count occurrences of each item in an array.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

752 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