Solved

CGI on AS400

Posted on 2002-04-22
2
822 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

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
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 …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Suggested Courses

617 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