Using Net Express 5.0, I'm trying to call a cobol program compiled as an EXE from an AJAX call in Javascript, passing the data to the program using POST. If I pass the data with the URL, and I accept it in the cobol program from the command-line, everything works peachy. However, I have an application where I want to POST a really long string, so I'm trying to do a proper post, and just do ACCEPT rather than ACCEPT ... FROM COMMAND-LINE. When I try that, the program just hangs and I get a CGI timeout.
Here is the source of my test program:
$set preprocess(htmlpp) endp
*>****************************************************************
identification division.
*>****************************************************************
program-id. "ajaxtest".
*>****************************************************************
environment division.
*>****************************************************************
configuration section.
special-names.
call-convention 8 is llnk.
input-output section.
file-control.
*>****************************************************************
data division.
*>****************************************************************
file section.
working-storage section.
01 cmd-string pic x(80).
01 cnt pic 999 value 0.
01 OUTPUT-STRING PIC X(500) VALUE SPACES.
local-storage section.
linkage section.
*>****************************************************************
Procedure Division.
*>****************************************************************
main section.
accept cmd-string.
STRING "THE INPUT DATA IS " CMD-STRING INTO OUTPUT-STRING.
exec html
:OUTPUT-STRING
end-exec.
exit program.
stop run.
And here is my Javascript with the AJAX call:
function gobtn_onclick_func()
{
with(document.form1)
{
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var postdata = "un=" sessionID.value screenID.value userName.value companyID.value;
xmlhttp.open("POST", "ajaxtest.exe", false);
xmlhttp.setRequestHeader("Content-type","application/text");
xmlhttp.send(postdata);
document.write(xmlhttp.responseText);
}
}
If, in the cobol program, if I change the the ACCEPT statement to:
accept cmd-string from command-line
and, in the JavaScript, the send method to:
xmlhttp.open("POST", "ajaxtest.exe?", postdata, false)
it works fine.
What do I need to change to be able to bring in the data from something other than the command line?
#Ajax
#COBOL
#JavaScript