Ever since Kernigan and Ritchie wrote the book on C, it is customary to introduce a new programming language or platform with a HelloWorld. Here we do the same with Webserver/IDMS. The following simple 'html' code in IDD is our starting point. Though the code itself is not any different from any other html, the important factor here is that it is stored in and executed from IDD!
ADD MOD HELLOWORLD LANGUAGE IS HTML
MOD SOURCE FOLLOWS
<html>
<body>
<title> Hello World with Webserver/IDMS</title>
<h1> Hello World with Webserver/IDMS </h1>
This is coming from IDMS Mainframe
</body>
</html>
When executed from Web, this appears as ('idms' after http refers to an ip address like 174.47.105.10 which is defined in HOSTS file of Windows)
Again this is very simple. But it works. It demonstrates the basic connection from Web to IDMS.
Obviously this is only a static html. One can ask, where is the program here? Can you show us one with a program?
Well we wanted to start with 'Hello World', and we just did
that. We can show you a complete program from IDMS. This will be
much more than Hello World, since it contains database access.
Here we go:
The following program displays all the departments from Cullinet
Sample Employee Database.
Here is the picture first followed by the whole source.
Complete ADS Source follows: [ is the comment symbol which appears as ! in ADS Manuals]
ADD
PROCESS NAME IS PHELLO1-PM VERSION IS 1
DESCRIPTION IS 'WEB EXAMPLE 02'
PUBLIC ACCESS IS ALLOWED FOR ALL
*+ USED BY PROGRAM DHELLO1 VERSION 1
*+ TEXT IS PREMAP
MODULE SOURCE FOLLOWS
------------------------------------------------------------
INITIAL VALUES TO VARIABLES -
------------------------------------------------------------
MOVE SPACE WWWWHTML-TXT.
--------------------------------------------------------
move '<html><body bgcolor=FFFFF0>'
to wwwwhtml-txt.
call wwwsend.
move '<h1>Hello World with Database Access</h1>'
to wwwwhtml-txt.
call wwwsend.
move '<pre> <br>Dept-ID Department Name <br>'
to wwwwhtml-txt.
call wwwsend.
OBTAIN FIRST DEPARTMENT within org-demo-region
allowing(db-any-error).
if (db-any-error)
MOVE 'Critical Database Error ' TO WWWWHTML-TXT.
While db-status-ok
REPEAT.
MOVE con ('<br>', dept-id-0410, ' ',
dept-name-0410) to wwwwhtml-txt.
call wwwsend.
OBTAIN NEXT DEPARTMENT within org-demo-region
allowing(db-any-error).
IF DB-END-OF-SET
MOVE '<p><br> <br>Here is the Department
Information' TO WWWWHTML-TXT.
ELSE MOVE 'Critical Database Error ' TO WWWWHTML-TXT.
END.
CALL WWWSEND.
move '</body></html>'
to wwwwhtml-txt.
CALL WWWSEND.
RETURN.
-------------------------------
DEFINE WWWSEND.
--------------------------------
MOVE SLEN(EXTRACT(WWWWHTML-TXT)) TO WWWWSLEN.
PUT SCRATCH AREA ID WWWWHTML-SCR FROM WWWWHTML-TXT LENGTH
WWWWSLEN.
GOBACK.
MSEND
A mapless dialog 'DHELLO1' is compiled out of this. Vega work record WWWPARM is also used. Nothing else.
The author of this writeup has seen several Web applications in production (Commercial as well as Games and Personal Pages). Never seen anything as simple as this. Any Perl or asp Code with database access is more complicated than this! We showed this code and sample to some of the 'Modern Boys' of Silicon Valley Culture (who are themselves experts in Perl, Java, JSP, Beans etc). All were spellbound!
That's all! Once Vegasoft Webserver is installed on IDMS, That's all needed to have Web Access. Nothing on PC. Nothing on any 'xyz' Server.
We could beautify this page with colors etc easily. That's simple html programming. 'GIF' and 'JPGs' can also be put in IDD and accessed from the Web.
IDMS/MVS is the Webserver as well as the Database Server. The executed program code (ADS here) is compiled code as against interpreted stuff we see on the so called 'Modern' platforms.
The above web dialog does not take any input. A real application should support terminal I/O and use 'forms' for input. Yes, we will demonstrate just that in the next article.
Though ADS based web dialogs are impressive and serve the purpose in most cases, some sites have problems (not technical, but 'religious') in integrating this setup with other web applications which are traditionally 'Unix Server' based. But such integration is in fact possible even in our case. Webserver/ADS is only an umbrella on top of TCP/IP Socket Interface or Gateway to IDMS, which is the key component. One can program in Java or C and still access a server dialog in IDMS and get information. Instead of Web the output will be directed to the client (Java for example). Then Java front-end can diagnose the output and take appropriate action. Java program itself can run on the Client side or as many people want on the 'Unix/NT based Webserver'. This will be similar to running JSP. A JSP program running on Unix-Webserver will be the server program for the traditional client, but the same JSP will be a client for IDMS/Server.
After the ADS/Web demo programs we will at least demonstrate a simple Java program accessing Server Dialog using http/ip address URL protocol. At the time of this writing, Vegasoft has also come up with a more programmable interface for Java Clients - VG-Java Client. We will have a look at Java Client later in the series.