Highlighted
Absent Member.
Absent Member.
2142 views

Web/CGI Example?

Jump to solution

In regards to the Personal Edition of Visual COBOL - what features are supported for CGI programs? 

I have found the EXTERNAL-FORM and EXEC-HTML facilities.

EXEC HTML errors out for me. Using the command line so I can more easily copy the results into this note, here is an example: 

This source code:

EXEC HTML
<HR>MESSAGE VALUE = [:O-MESSAGE]<br>
END-EXEC

Causes this error: 

paul@LNX1:~/web/cobsrc> cob -xo ../bin/CGI001 CGI001.cbl
CGI001.o: In function `CGI001':
CGI001.cbl:(.text+0x41d): undefined reference to `HTML'

The External Forms stuff works pretty well, but it feels a little old. Sending the entire form back each time a request happens isn't all that efficient either. 

Has anyone gotten this to work with say, XML or modern Ajax based screens? If so, do you have an example you would be willing to share? I normally send XML from Ajax screens and expect an XML reply. 

Yours,

-Paul 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Web/CGI Example?

Jump to solution

In order for the exec html statements to work you have to turn on the preprocessor directive:

EHTML Preprocessor  

EHTML is an integrated preprocessor provided with this system and designed to work closely with the Micro Focus COBOL Compiler. It identifies HTML embedded in COBOL code as delineated by EXEC HTML statements, and outputs the HTML to your Web server.

To run the EHTML preprocessor, set the PREPROCESS Compiler directive to htmlpp using one of the following methods:

Code a $SET statement before the first line in your COBOL program file using the following syntax :

$SET preprocess(htmlpp) [EHTML-directive(s)] endp

Where EHTML-directive(s) is one or more EHTML preprocessor directives.
See EHTML Preprocessor Directives for more information

--------------------------------------

I believe that this is the extent of what we have for the Linux/Unix systems for HTML support directly from COBOL.

We do also support the use of XML through an integrated XML preprocessor which would allow you to assign an xml stream directly to the I-O of a cgi program so that you could pass xml messages back and forth.

This is documented here:.


For JVM COBOL you can code your web pages in Java and then call your COBOL programs directly as JVM code.

Under the Visual COBOL for Visual Studio products there is also full support for creating ASP.NET web applications or web sites including the use of AJAX, etc.

Thanks.

View solution in original post

0 Likes
2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Web/CGI Example?

Jump to solution

In order for the exec html statements to work you have to turn on the preprocessor directive:

EHTML Preprocessor  

EHTML is an integrated preprocessor provided with this system and designed to work closely with the Micro Focus COBOL Compiler. It identifies HTML embedded in COBOL code as delineated by EXEC HTML statements, and outputs the HTML to your Web server.

To run the EHTML preprocessor, set the PREPROCESS Compiler directive to htmlpp using one of the following methods:

Code a $SET statement before the first line in your COBOL program file using the following syntax :

$SET preprocess(htmlpp) [EHTML-directive(s)] endp

Where EHTML-directive(s) is one or more EHTML preprocessor directives.
See EHTML Preprocessor Directives for more information

--------------------------------------

I believe that this is the extent of what we have for the Linux/Unix systems for HTML support directly from COBOL.

We do also support the use of XML through an integrated XML preprocessor which would allow you to assign an xml stream directly to the I-O of a cgi program so that you could pass xml messages back and forth.

This is documented here:.


For JVM COBOL you can code your web pages in Java and then call your COBOL programs directly as JVM code.

Under the Visual COBOL for Visual Studio products there is also full support for creating ASP.NET web applications or web sites including the use of AJAX, etc.

Thanks.

View solution in original post

0 Likes
Highlighted
Absent Member.
Absent Member.

RE: Web/CGI Example?

Jump to solution

Thanks Chris - I read the words "integrated processor" in the docs and immediately skipped over the rest of it to the example. (*sigh*)

Works great if one turns it on!

-Paul

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.