Hello Friends,
To all my friends who just started AS400 learning/working or having few
years of experience on it, this article is going to give you some basics of how
we can combine AS400 with HTML. After reading this article you guys may get
awesome ideas and explore more on this by your own.
This article is indented for people who know basics of HTML and AS400.
Where to store our HTML:
AS400 IFS path is the
place you write your own HTML and store it. Either you can write it in physical
file and copy it to IFS or just a simple notepad and upload (or FTP) the file
into your IFS directory.
Sample file: Do note the IFS path I have stored the file
Starting Apache server:
Yes, AS400 (version >= V4R5) comes with in build Apache server. This will
be used to handle HTTP request coming into AS400. Use below command to check if
your HTTP server is already running.
WRKACTJOB SBS(QHTTPSVR)
If not start it using
below command
STRTCPSVR *HTTP HTTPSVR(*ADMIN)
Use this command to start Apache Default server
STRTCPSVR SERVER(*HTTP) HTTPSVR(APACHEDFT)
Now just point
your AS400 IP in your browser and look for index.html
E.g.
http://yourip/index.html
Apache Config:
/www/apachedft/conf/httpd.conf is the configuration
file for apache and make sure below piece of code is available in it
It states all the documents are from
/www/apachedft/htdocs so the index.html should be inside this directory. And any html file we create in this path will be accessible
in your browser.
So let’s view our welcome.html (from htdocs path)
How to retrieve HTML from different IFS path:
So it is not restricted that we have to place our
entire HTML inside document root path. Instead we can use Alias match and
assign specific IFS folder for document retrieval.
Just edit the httpd.conf file of apachedft and add
these lines.
So if anything comes as /mydocs/ in url will look for
files from /Home/Devyus directory.
e.g.: http://yourip/mydocs/welcome.html
before we test this we have to restart our APACHEDFT
server since we have modified the config file
STRTCPSVR SERVER(*HTTP) RESTART(*HTTP)
HTTPSVR(APACHEDFT)
After restart check it in browser using above example
url
What Next?
So till now it is not a big deal because we are just showing some static HTML page available from AS400 IFS. What is really interesting will be, how to use this functionality as front end and which calls RPGLE program based on inputs and RPGLE returns output back to browser. Looks great is it…
So till now it is not a big deal because we are just showing some static HTML page available from AS400 IFS. What is really interesting will be, how to use this functionality as front end and which calls RPGLE program based on inputs and RPGLE returns output back to browser. Looks great is it…
Yes, It is possible using CGI programming in AS400. I
shall come back soon with some basic example of how CGI works and how to build
our first web based application which integrates with our RPGLE business logic
and DB2 database and produces result back on the web. Until then…
Have Fun…!!! Happy coding..!!!
Very informative post to learn. Especially for people who are new to html
ReplyDeleteThanks for your feedback!!!
DeleteAwesome man, I was struggling with hosting web pages on AS400. Great work ����
ReplyDeleteSounds good..!!! Thank you! You can also check out my other post regarding AS400 web development using
Deletehttps://yusy4code.blogspot.sg/p/as400-web-options.html
Hope this helps!!
Very interesting read, Thanks for sharing it :)
ReplyDeleteHI YUSUF... so css also can be combine in this???????
ReplyDeleteHi Yusuf
ReplyDeleteI dont see the web page details when i enter myip/index.html. Do i need to do some settings for the apacheserver before doing that. Just to add APACHEDFT is up and running