Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Using COBOL as a cgi program.
I understand that there is an interface program available from Liant. But is
there a more general solution? I use Tiny Cobol and sometimes Open Cobol.
--
John Culleton
Able Indexers and Typesetters

Report this thread to moderator Post Follow-up to this message
Old Post
John Culleton
09-06-05 11:55 PM


Re: Using COBOL as a cgi program.
"John Culleton" <john@wexfordpress.com> wrote in message
news:ab2dnXJ3h8OjMYDeRVn-og@adelphia.com...
>I understand that there is an interface program available from Liant. But
>is
> there a more general solution? I use Tiny Cobol and sometimes Open Cobol.

See the responses made to your other post on the same topic: you can
interface with the web server via the command line arguments, environment
variables and standard out.

- Oliver



Report this thread to moderator Post Follow-up to this message
Old Post
Oliver Wong
09-06-05 11:55 PM


Re: Using COBOL as a cgi program.
> is there a more general solution?

The standard CGI mechanism from many web servers only requires the use
of stdin, stdout and environment variables. These can be accessed in
many Cobol versions.

I have had the same Cobol code (with a handful of different lines) run
on OS/2 with an IBM server, Windows with PWS and Xitami server, Linux
with Apache, SCO with Netscape.  It even ran using a DOS based
(DR-Multiuser-DOS) server and one that ran on Windows 3.x.

With standard CGI most stuff is passed as environment variables and the
message may be in QUERY_STRING or you may need to accept to get it from
stdin. The trick is to ensure that only the length specified in
CONTENT_LENGTH is accepted otherwise the program will hang (depending
on compiler version).

You need to process the input because, for example, spaces will arrive
as %20 and the form field will be strung as name=value&name2=value2.

For ouput just display to stdout. You _NEED_ to display a mime header
"Content-type: text/html" _AND_ _TWO_ _LINEFEEDS_. Otherwise you will
get nothing at all.

The rest is just html.

I use a templating method to do output. The program makes up an array
of field-name, field-value pairs and passes this to a templating module
which reads the template text and substitutes the field-value whereever
it sees a <!%field-name%>.

This means that I can change the page without having to recompile, or
even just output XML, or plain text, or postscript, or CSV, or ...

Just read a book on CGI and code it up.


Report this thread to moderator Post Follow-up to this message
Old Post
Richard
09-06-05 11:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:55 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.