Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

CGI on AS400

Posted on 2002-04-22
2
Medium Priority
?
832 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 300 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

715 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