[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[open-cobol-list] Playing with OC and AJAX
From: |
Michael Anderson |
Subject: |
[open-cobol-list] Playing with OC and AJAX |
Date: |
Mon, 02 Jan 2012 21:44:38 -0600 |
A great working example written by Brian Tiffin, of COBOL processing an ajax request sent by a client Web browser, cool stuff!
if (name-string(name-index) = "REQUEST_METHOD")
and (value-string = "POST")
open input webinput
read webinput
at end move spaces to postchunk
end-read
Then the response is sent back to the client browser, from the server, using a COBOL DISPLAY.
Now this gets me thinking about putting many old COBOL apps on the web, and a question comes to mind.
Can a single COBOL process send and receive data to and from a web browser, just like it did with the old terminal?
The only difference would be instead of the old terminal instructions, it would now send/receive JSON ogjects.
The JSON objects would then be processed in the web browser using _javascript_, could be cool with HTML5 and CSS3.
My normal method is to play around with it, and eventually I get the answer from the process.
Playing around with it, I modify this example to process multiple ajax requests within the same cgi process.
Sadly the next 'read webinput' does not wait for more data to be sent from the browser.
I was hoping it would wait, after-all, webinput is actually stdin, and usually when reading from stdin the process will be blocked/locked until there is actual data to be read.
The fact is that Web server CGI I/O is non-blocked I/O.
Anyone have any suggestions, how would you code this to wait for another ajax request?
I'm thinking that maybe FastCGI might be a solution, and since I generally use a Tcl interpretor with COBOL, maybe using Tcl with FastCGI would be even better.
--
All ideas welcome!
Mike.
- [open-cobol-list] Playing with OC and AJAX,
Michael Anderson <=