Re: COBOL for utility program under Linux.



"Richard" <riplin@xxxxxxxxxxxx> wrote in message
news:7305512a-f9cc-48be-96a0-c82e9ab18f5e@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MCM wrote
CGI really only needs ACCEPT and DISPLAY 'UPON COMMAND LINE'

CGI generally is reading from or writing to STDIN and STDOUT. (on unix,
<> 'stdin' and 'stdout')

'UPON COMMAND LINE' is not stdin and stdout, it is the stuff following
the program name as parameters to the command.

'UPON CONSOLE' probably is stdin and stdout (depending on
implementation).

Woo, the seven years since I last did anything in COBOL has apparently taken
its toll. (Or maybe it's the increased number of candles on the birthday
cake?)

When ACCEPTing from stdin (or CGI) it is usually necessary to use the
length of the text (which is supplier in an environment variable) as a
limit on the data as otherwise it will require a timeout or similar.

Surely there is another way to use standard handles with COBOL other than
DISPLAY/ACCEPT. (READ and WRITE come to mind) .

Why would you need 'another way' ?

Because as you point out, you may need the length to execute the ACCEPT,
which you don't have. Under Windows using my BASIC complier, you can detect
"end of file" on STDIN when reading the HTML submitted by the caller...
thereby giving you everything you need to process. Granted it's clunkier to
do that in COBOL, but it should be doable. Maybe you have to read it in a
byte at a time, but when EOF is detected, that's all there is, there ain't
no more.

But I guess..... you could ACCEPT a byte at a time until there ain't no
more? IOr maybe is there a facility with ACCEPT to detect "no data
availale?" Damn, I simply can't remember anymore. I suppose I could look it
up.....wow, I forgot about all the MF extensions to ACCEPT... both TIME-OUT
and ON EXCEPTION look like they will support handilng the
unknown-when-you-start-variable-lengthness of the input. So I guess you are
correct about ACCEPT being plenty, as long as the conpiler supports
something akin to the MF extensions.

I was just trying to help.

MCM






.



Relevant Pages

  • Re: OO Reuse
    ... >> when reading about software, you may find a reference to ... Does a true COBOL programmer need those CRC cards - I think not. ... > The point of mentioning Simon - young, bright and can absorb stuff like ... > famous English tea firms. ...
    (comp.lang.cobol)
  • Re: Reading Simple Flatfiles with a COBOL Mindset
    ... I am new to C and old to COBOL ... > in with respect to reading a simple file - one record at a time. ... stream and impose your interpretation on them: ... there are text streams and binary streams. ...
    (comp.lang.c)
  • Re: Reading Simple Flatfiles with a COBOL Mindset
    ... # in with respect to reading a simple file - one record at a time. ... In COBOL, my simple file ... On most C implementations you can overlay a struct of just charfields ... # read employee-flatfile into employee-record. ...
    (comp.lang.c)
  • Re: question about /proc/<PID>/mem in 2.4 (fwd)
    ... > things doesn't prevent the program from reading it's own address space. ... > and this program reading stdin. ... http://www.openwall.com - bringing security into open computing environments ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: how to speed up smalltalk file I/O
    ... Looks like the problem is that you're reading from stdin, ... Integers (after the number it "eats" the non-numeric character and then ... thing displayNl. ... s:= FileStream stdin. ...
    (comp.lang.smalltalk)