I posted something like this sometime ago but since then Microsoft IE6 updates prevented it from working. Here is the latest version which has been tested with the latest Internet Explorer 6 updates.
It allows you to use your IE6 browser on the client-side to provide a GUI front-end interface to a COBOL PC program. To bypass browser security without updating your browser settings, use an HTA extension instead of an HTM extension.
This example brings up a text-box in a browser. Type in something and then click launch COBOL. Whatever you typed in will be written to a file, MYFILE.TXT. The COBOL program opens MYFILE.TXT and, for the purpose of this example, reads the record and writes it out to a new file OUTFILE.TXT. When the COBOL program has executed the browser will close.
IE6TOCBL.hta (browser filename)
*************************************
<html><head>
<title>Using Your Browser as a COBOL Front-end</title>
<meta http-equiv="Pragma" content="no-cache">
<!--
**** This javascript subroutine is called when
**** the form's "Launch COBOL" button is clicked.
**** It calls two subroutines, writeToFile & Launch.
-->
<script language="JavaScript" type="text/javascript">
function process(data) {
writeToFile(data);
timer=setTimeout('launch()',5000)
}
</script>
<!--
**** This vbscript subroutine is called to write
**** the contents of the textarea to a file.
**** In this case the file is name MYFILE.TXT
-->
<script type="text/vbscript">
sub writeToFile(data)
set oFS = createobject("scripting.filesystemobject"
set oFile = oFS.opentextfile("MYFILE.TXT", 2, true)
oFile.writeline(data)
oFile.close()
set oFile = nothing
set oFS = nothing
end sub
</script>
<!--
//**** This javascript subroutine is called after
//**** the form's data has been written to a file.
//**** It will launch the COBOL program which will
//**** read the file. In this case the program is
//**** called, MYCOBOL.EXE
-->
<script language="JavaScript" type="text/javascript">
function launch() {
document.writeln('MYCOBOL.EXE STARTED<br />')
document.writeln('Please Wait...<br /><br />')
document.writeln('<object width="0px" height="0px"')
document.writeln('classid="CLSID:018B7EC3-EECA-11d3-8E71-0000E82C6C0D"')
document.writeln('codebase="MYCOBOL.EXE"></object>')
timer=setTimeout('window.close()',10000)
}
</script>
<!-- **** This is the HTML for the form **** -->
</head><body style="background:yellow"><form name="form1">
<textarea name="ta" rows="10" cols="50"></textarea>
<br /><br />
<input type="button" value="Launch COBOL"
onClick="process(document.form1.ta.value)" />
</form>
</body></html>
COMPILE THIS PROGRAM TO MYCOBOL.EXE:
IDENTIFICATION DIVISION.
PROGRAM-ID. MYCOBOL.
AUTHOR. CLIVE CUMMINS.
INSTALLATION. DATE-WRITTEN. Nov 23,2003.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT MYCOBOL-FILE ASSIGN TO MYCOBOL-FILE-ID
FILE STATUS IS MYCOBOL-RETURN-CODE
ACCESS MODE IS SEQUENTIAL
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD MYCOBOL-FILE.
01 MYCOBOL-RECORD PIC X(4000).
WORKING-STORAGE SECTION.
01 MYCOBOL-PARAMETERS.
05 MYCOBOL-RECORD-WORK PIC X(4000).
05 MYCOBOL-FILE-ID PIC X(12)
VALUE "MYFILE.TXT".
05 MYCOBOL-RETURN-CODE PIC X(2).
PROCEDURE DIVISION.
OPEN INPUT MYCOBOL-FILE.
READ MYCOBOL-FILE INTO MYCOBOL-RECORD-WORK.
CLOSE MYCOBOL-FILE.
MOVE "OUTFILE.TXT" TO MYCOBOL-FILE-ID.
OPEN OUTPUT MYCOBOL-FILE.
WRITE MYCOBOL-RECORD FROM MYCOBOL-RECORD-WORK.
CLOSE MYCOBOL-FILE.
GOBACK.
Clive
It allows you to use your IE6 browser on the client-side to provide a GUI front-end interface to a COBOL PC program. To bypass browser security without updating your browser settings, use an HTA extension instead of an HTM extension.
This example brings up a text-box in a browser. Type in something and then click launch COBOL. Whatever you typed in will be written to a file, MYFILE.TXT. The COBOL program opens MYFILE.TXT and, for the purpose of this example, reads the record and writes it out to a new file OUTFILE.TXT. When the COBOL program has executed the browser will close.
IE6TOCBL.hta (browser filename)
*************************************
<html><head>
<title>Using Your Browser as a COBOL Front-end</title>
<meta http-equiv="Pragma" content="no-cache">
<!--
**** This javascript subroutine is called when
**** the form's "Launch COBOL" button is clicked.
**** It calls two subroutines, writeToFile & Launch.
-->
<script language="JavaScript" type="text/javascript">
function process(data) {
writeToFile(data);
timer=setTimeout('launch()',5000)
}
</script>
<!--
**** This vbscript subroutine is called to write
**** the contents of the textarea to a file.
**** In this case the file is name MYFILE.TXT
-->
<script type="text/vbscript">
sub writeToFile(data)
set oFS = createobject("scripting.filesystemobject"
set oFile = oFS.opentextfile("MYFILE.TXT", 2, true)
oFile.writeline(data)
oFile.close()
set oFile = nothing
set oFS = nothing
end sub
</script>
<!--
//**** This javascript subroutine is called after
//**** the form's data has been written to a file.
//**** It will launch the COBOL program which will
//**** read the file. In this case the program is
//**** called, MYCOBOL.EXE
-->
<script language="JavaScript" type="text/javascript">
function launch() {
document.writeln('MYCOBOL.EXE STARTED<br />')
document.writeln('Please Wait...<br /><br />')
document.writeln('<object width="0px" height="0px"')
document.writeln('classid="CLSID:018B7EC3-EECA-11d3-8E71-0000E82C6C0D"')
document.writeln('codebase="MYCOBOL.EXE"></object>')
timer=setTimeout('window.close()',10000)
}
</script>
<!-- **** This is the HTML for the form **** -->
</head><body style="background:yellow"><form name="form1">
<textarea name="ta" rows="10" cols="50"></textarea>
<br /><br />
<input type="button" value="Launch COBOL"
onClick="process(document.form1.ta.value)" />
</form>
</body></html>
COMPILE THIS PROGRAM TO MYCOBOL.EXE:
IDENTIFICATION DIVISION.
PROGRAM-ID. MYCOBOL.
AUTHOR. CLIVE CUMMINS.
INSTALLATION. DATE-WRITTEN. Nov 23,2003.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT MYCOBOL-FILE ASSIGN TO MYCOBOL-FILE-ID
FILE STATUS IS MYCOBOL-RETURN-CODE
ACCESS MODE IS SEQUENTIAL
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD MYCOBOL-FILE.
01 MYCOBOL-RECORD PIC X(4000).
WORKING-STORAGE SECTION.
01 MYCOBOL-PARAMETERS.
05 MYCOBOL-RECORD-WORK PIC X(4000).
05 MYCOBOL-FILE-ID PIC X(12)
VALUE "MYFILE.TXT".
05 MYCOBOL-RETURN-CODE PIC X(2).
PROCEDURE DIVISION.
OPEN INPUT MYCOBOL-FILE.
READ MYCOBOL-FILE INTO MYCOBOL-RECORD-WORK.
CLOSE MYCOBOL-FILE.
MOVE "OUTFILE.TXT" TO MYCOBOL-FILE-ID.
OPEN OUTPUT MYCOBOL-FILE.
WRITE MYCOBOL-RECORD FROM MYCOBOL-RECORD-WORK.
CLOSE MYCOBOL-FILE.
GOBACK.
Clive