Solved

CGI on AS400

Posted on 2002-04-22
2
769 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
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
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 about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now