Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

talking with your web browser 4

Status
Not open for further replies.

Crox

Programmer
Apr 3, 2000
892
NL
Hi,

I wonder if there is an easy way to have a program that uses the HTML browser as if it was a screen. Of course this is possible on the server, but now I like to do it an other way. To start any HTML page is easy. You write you html page in COBOL and with a start command, it is happening. But now if the user fills in anything in the html page and pushes a button, how can you get the information back? It doesn't matter to me if this is by reading any data, reading a cookie, doing some API talk with the browser, I don't care but I don't know enough of the browser environment to know how you can do this the best.

It is also not difficult to have a separate task on you machine, looking for data which is going to exists in some directory.

Any suggestions are most welcome. Does anybody has experience with this?
 
Crox, or anyone? Thane?
Do you have some sample cobol to html code>? I have some ideas I am playing around with for specific pages to be returned based on parms passed in JCL that is fired off to our mainframe, and the result html ftp'd to our web server.
Thanks

Tomavery
Go Canucks! (rabid Vancouver Canucks Fan)
 
Crox,

a quote:

"To start any HTML page is easy. You write you html page in COBOL and with a start command, it is happening."
Yeah... right ?!! You've already lost me there, buddy !!!
I haven't got the foggiest, but i can imagine any input from a HTML form can be read into a COBOL program using an ACCEPT statement, but as i mentioned earlier, i'm off at the deep end here.

Keep us all informed ... please ?!!
 
Hi,

it is some time ago I posted this here, but the answer is easy: In most COBOL programs you can start some process like any batch process, just giving a dos command for example:

start "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
Using this command in the windows environment, you will start on the tek-tips forum.

I am using the iexplore program, but it works in the same manner with other browsers. If you use the start command with a html file, so instead of you use myfile.htm, it will start your htm file.

If you leave the exe file out, your current browser session can be changed because it will load the new file.

If you are working with a server, you can work with a device STDIN and STDOUT to let your program be between the server and the browser. But... I work with CA-REALIA COBOL and I want to talk directly with the browser program. I want if the user is pushing the html button, I want the response to go directly to my program if that is possible.

I have a character oriented COBOL generator. You can input 1 to 99 screen definitions and it will generate a program that assumes you want 1-to-1 have a screen with a database behind for that screen. Easy, no intelligence, just a lot of work be done at once, say 1 second :) I want that program to be changed into working with html. That is all I want. But I don't have so much time to find everything out. I didn't find some API calls to talk with a specific or a general browser, but I assume they are there. Perhaps somebody can point me to it.

Perhaps it can be done with JAVA script. I would like to see an example that works in my environment.

Writing html in COBOL is also not difficult. You just write it as text. No problem. You just take some example html sources and you code them in you working-storage and you fill in the variable parts in you program. You write it as text into a file. On the mainframe you will perhaps have EBCDIC so you translate it into ASCII. There are mainframe tools, PC tools and also COBOL tools to do this.

In the book COBOL unleashed there are some examples working with HTML, but not the way I want it.

I hope this is helpful.

Tell us all about working with COBOL and HTML! :)
 
Hi RonaldB,

The start command is not available on the mainframe. If there would be any kind of browser on the mainframe, you could start it in several ways:

1) call it directly
2) using IKJEFT01 to let TSO do it for you with a TSO command
3) writing a job to the internal reader.

I never had the fun to work with HTML on the mainframe. The mainframe I work with, don't deal with graphical images, several display fonts, etc.

In writing it does. The old DCF system was ok. AFP is also ok. But I didn't find a graphical terminal yet that displays AFP output in a WYSIWYG way. But it probably exists but is probably not very common, too expesive perhaps.

Let me know if you work with true mainframe webbrowsing. Perhaps it is possible to make something talking with a PC using LU 6.2.

Greetings,

Crox
 
Fujitsu has some great examples of their method of doing HTML CGI and ISAPI dlls from COBOL. Personally I have coded such programs using a VMS host and just directing the output to the standard output device. However, for PC and NT based stuff I like the Flexus Web Client product -
 
Thane,
Do you have any sample code of MVS to html, cgi etc...
I really really want to do this. I have seen but can't find anymore a program that created the html header, and populated tables then attached an html footer. I want to use a control break type sequence to gather the data and send it to <next page> type html. Then if possible ftp it to the NT server into its own (requester directed parm) directory, so they can push a reload button. I dont really want to add outside additional programs other than our standard MVS and NT IIS. the only exception being a sun box if i need to.
Any advice is appreciated.

Tom
Go Canucks! (rabid Vancouver Canucks Fan)
 
Crox,

as far as i know we don't have a mainframe web browser, in fact we don't use a graphic environment at all. I've been tinkering with a COBOL program reading an XML message and sending an XML reply, but communication went via the IMS queue (or should, because we never got it to work within the given time).

All web based applications under development at my site or in fact up and running use the mainframe as a super server, communicating with some sort of web client as front end. I don't have any specific technical information, but maybe i can dig up something if anyone is interested (of course i gotta think about the company interests, too !)

Good luck !
 
Hello Tom,

I don't have an example, but I can tell you in general how I did it on VMS.

First I took my favorite web page editor and created a &quot;template&quot;. In the template I placed ~SOMETHING~ where I wanted to substitute other values.

Then in my COBOL program I read the template and substitute data values where appropriate as I output the HTML. There is very little actual HTML in the COBOL program.
 
I realize this is an old thread but if anyone is still interested in using a browser on the client side to interface with a PC COBOL program on the client side, I have figured out a way to do it.
 
Please post it.

Thanks
Go Canucks! (rabid Vancouver Canucks Fan)
 
It is great to see some good examples! Perhaps it is nice to put it in a FAQ?

Thanks in advance!

Regards,

Crox
 
OK. Take a look at it then I'll add some comments and any ideas you may have and then make a FAQ.

InScreen.htm
************
<html><head>
<style>
hr {color:red}
body {color:black; background:yellow}
</style>
<script>
function WriteCookie()
{iUserId=window.document.forms[0].iUserId.value
expireDate=&quot;Thursday, 20-Feb-2048 08:30:00 GMT&quot;
document.cookie=&quot;PARMS=&quot;+iUserId+&quot;;expires=&quot;+expireDate}
</script>
<title>Calling COBOL Demo - InScreen by Clive Cummins</title></head>
<body><div align=center>
<h1>Calling COBOL Demo - InScreen</h1><hr />
<form>UserId: <input type=&quot;text&quot; name=&quot;iUserId&quot; /><br /><br />
<input type=&quot;button&quot; value=&quot;Save&quot; onClick=&quot;WriteCookie()&quot; /></form>
<button onClick='window.self.location=&quot;htmldemo.htm&quot;'>Execute</button>
</div></body></html>

htmldemo.htm
************
<html><head><title>Calling COBOL program HTMLDEMO</title></head>
<body>
<object codebase=&quot;C:\htmldemo\htmldemo.exe&quot;
classid='clsid:10000000-0000-0000-0000-000000000000'></object>
</body></html>

htmldemo.cbl
************
IDENTIFICATION DIVISION.
PROGRAM-ID. HTMLDEMO.
AUTHOR. Clive Cummins.
INSTALLATION. DATE-WRITTEN. Mar 8,2002.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT COOKIE-FILE ASSIGN TO COOKIE-FILE-ID
FILE STATUS IS COOKIE-RETURN-CODE
ACCESS MODE IS SEQUENTIAL
ORGANIZATION IS LINE SEQUENTIAL.
SELECT OUSCREEN-FILE ASSIGN TO OUSCREEN-FILE-ID
FILE STATUS IS OUSCREEN-RETURN-CODE
ACCESS MODE IS SEQUENTIAL
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD COOKIE-FILE.
01 COOKIE-RECORD PIC X(80).
FD OUSCREEN-FILE.
01 OUSCREEN-RECORD PIC X(72).
WORKING-STORAGE SECTION.
01 PROGRAM-DETAILS.
05 PROGRAM-RELEASE.
10 PROGRAM-NAME PIC X(08) VALUE 'HTMLDEMO'.
10 PROGRAM-REL PIC X(08) VALUE ' 1.0.00'.
01 OUSCREEN.
02 FILLER PIC X(36) VALUE &quot;<html><head> &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 FILLER PIC X(36) VALUE &quot;<style> &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 FILLER PIC X(36) VALUE &quot;hr {color:blue} &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 FILLER PIC X(36) VALUE &quot;body {color:black; background:pink} &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 FILLER PIC X(36) VALUE &quot;</style> &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 FILLER PIC X(36) VALUE &quot;<title>Calling COBOL Demo - OutScree&quot;.
02 FILLER PIC X(36) VALUE &quot;n by Clive Cummins</title></head> &quot;.
02 FILLER PIC X(36) VALUE &quot;<body><div align=center> &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 FILLER PIC X(36) VALUE &quot;<h1>Calling COBOL Demo - OutScreen</&quot;.
02 FILLER PIC X(36) VALUE &quot;h1><hr /> &quot;.
02 FILLER PIC X(36) VALUE &quot;<h4>So... Your UserId is: &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 USERID PIC X(36) VALUE &quot;USERID &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
02 FILLER PIC X(36) VALUE &quot;</h4></div></body></html> &quot;.
02 FILLER PIC X(36) VALUE &quot; &quot;.
01 FILLER REDEFINES OUSCREEN.
02 OUSCREEN-ENTRY PIC X(72) OCCURS 011 INDEXED BY OUSCREEN-IDX.
01 WORK-AREAS.
05 COOKIE-NAME PIC X(80).
05 COOKIE-VALUE PIC X(80).
05 COOKIE-RETURN-CODE PIC X(02).
05 COOKIE-FILE-ID PIC X(12) VALUE &quot;HTMLDEMO.TXT&quot;.
05 COPY-COOKIE-FILE PIC X(16) VALUE &quot;HTMLDEMO.BAT&quot;.
05 OUSCREEN-RECORD-WORK PIC X(72).
05 OUSCREEN-FILE-ID PIC X(12) VALUE &quot;OUSCREEN.HTM&quot;.
05 OUSCREEN-RETURN-CODE PIC X(02).
88 OUSCREEN-SUCCESSFUL VALUE ZERO.
05 START-OUTPUT-SCREEN.
10 FILLER PIC X(50) VALUE
'&quot;C:\PROGRAM FILES\INTERNET EXPLORER\IEXPLORE.EXE&quot;'.
10 FILLER PIC X(24) VALUE
&quot;C:\htmldemo\OUSCREEN.HTM&quot;.
01 CALL9135-PARAMETERS.
05 CALL9135-CALL-FUNCTION PIC X(01) VALUE 35 COMP-X.
05 CALL9135-RETURN-CODE PIC X(01) VALUE 0 COMP-X.
05 CALL9135-COMMAND-LENGTH PIC X(01) VALUE 0 COMP-X.
PROCEDURE DIVISION.
PERFORM COPY-COOKIE.
PERFORM PROCESS-INPUT.
PERFORM PROCESS-OUTPUT.
PERFORM START-OUSCREEN.
GOBACK.
COPY-COOKIE.
DISPLAY COPY-COOKIE-FILE UPON COMMAND-LINE.
CALL x'91' USING CALL9135-RETURN-CODE
CALL9135-CALL-FUNCTION
CALL9135-COMMAND-LENGTH.
PROCESS-INPUT.
OPEN INPUT COOKIE-FILE.
IF COOKIE-RETURN-CODE EQUAL ZERO
PERFORM READ-COOKIE
MOVE COOKIE-RECORD TO COOKIE-NAME
PERFORM READ-COOKIE
MOVE COOKIE-RECORD TO COOKIE-VALUE
ELSE
DISPLAY COOKIE-FILE-ID
DISPLAY &quot;File not found&quot;.
CLOSE COOKIE-FILE.
READ-COOKIE.
READ COOKIE-FILE.
PROCESS-OUTPUT.
MOVE COOKIE-VALUE TO USERID.
OPEN OUTPUT OUSCREEN-FILE.
IF OUSCREEN-RETURN-CODE EQUAL ZERO
PERFORM PUT-HTM-RECORD
VARYING OUSCREEN-IDX FROM +1 BY +1
UNTIL OUSCREEN-IDX GREATER THAN 011.
CLOSE OUSCREEN-FILE.
PUT-HTM-RECORD.
MOVE OUSCREEN-ENTRY (OUSCREEN-IDX) TO OUSCREEN-RECORD-WORK.
INSPECT OUSCREEN-RECORD-WORK REPLACING ALL X&quot;F8&quot; BY X&quot;22&quot;.
INSPECT OUSCREEN-RECORD-WORK REPLACING ALL X&quot;FB&quot; BY X&quot;27&quot;.
PERFORM WRITE-OUSCREEN-RECORD.
WRITE-OUSCREEN-RECORD.
WRITE OUSCREEN-RECORD FROM OUSCREEN-RECORD-WORK.
START-OUSCREEN.
DISPLAY START-OUTPUT-SCREEN UPON COMMAND-LINE.
CALL x'91' USING CALL9135-RETURN-CODE
CALL9135-CALL-FUNCTION
CALL9135-COMMAND-LENGTH.

htmldemo.bat
************
COPY &quot;C:\WINDOWS\COOKIES\default@C__HTMLDEMO_[1].TXT&quot; HTMLDEMO.TXT
 
By way of clarification, the only part that will not work is calling the COBOL program from the browser. You can still call the browser from COBOL and you can still read or alter the cookie using COBOL and you can still generate HTML from COBOL.
 
IBM have fantastic utilities available now. If you install CICS Transaction Server you automatically receive CICS WEB Support.

CICS Web Support is a set of services that allows direct access to CICS applications and transactions from a Web browser or Network Computer over TCP/IP, without the need for an intermediate gateway. Two new Application Programming Interface (API) commands – EXEC CICS WEB and EXEC CICS DOCUMENT - allow new or extended applications to exploit the Web, for example allowing creation and manipulation of HTML Web pages. In addition, support is provided so that existing applications and transactions can be accessed from the Web without change.

I have used these services and they allow your program to communicate directly with the browser through the CICS web API's.

 
I use a product called COBOL-CGIX. I'm able to access all my ISAM data files and interact with forms, write cookies, etc. I generate 75% of my pages using Dreamweaver and the rest from with my COBOL programs. It handles all the STDIN and STDOUT stuff. I'm running it on Win2K Server using IIS 5. You can check it out at Hope this helps.
 
There might be several ways to address adding an HTML page interface to a COBOL application. Ideally the interface should be a natural extension to the COBOL application and the interface scription should be in a familar syntax (COBOL). The most straight-forward method for converting your existing BMS maps to us the CICS Web Support. It doesn't cost anything additional and integrates into your existing S/390 COBOL application.

NON MAINFRAME OPTIONS
Ideally whatever the solution it should be available on &quot;Open&quot; systems and Windows. The reason is that most Web servers (Apache, etc.) have been traditionally run on Unix systems. Migration options back and forth between UNIX and Windows might be consideration with any implementation.

The COBOL applications running as a Servlet on a web server would be &quot;displaying&quot; and &quot;accepting&quot; from the HTML page inferface. While &quot;CGI&quot; might be thought of as an option it may not be as intuitive or as secure as a pure COBOL option.

A description of how an HTML page can be accessed with a COBOL compiler can be viewed in the LegacyJ PERCobol Programmer's Guide It is one option that may be inituitive and will run on most &quot;open&quot; systems.

Moving forward &quot;options&quot; may be important.
 
Hi,

the link does not work.

Regards,

Crox
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top