I use ACCEPT within a loop "all the time" for simple "SYSIN processing".
MOVE LOW-VALUES TO INPUT-AREA
ACCEPT INPUT-AREA
PERFORM UNTIL INPUT-AREA = LOW-VALUES
PERFORM PROCESS-INPUT-AREA
MOVE LOW-VALUES TO INPUT-AREA
ACCEPT INPUT-AREA
END-PERFORM
Frank
________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of
Bill Woodger <[email protected]>
Sent: Sunday, July 10, 2016 10:59 AM
To: [email protected]
Subject: Error in a simple COBOL program
No. If you look at the SYSIN dataset that was used in the original JCL, it is
has a DSN on it, a member of a PDS. The entire "session" responses can be
included within that dataset without a problem. Or with a problem if the data
does not conform to what the COBOL program "expects". It makes no difference
whether the program is run in batch or TSO with that DSN, it does matter that
the DSN is in the correct place.
If the intention was to have an actual interactive session there would be no
need to put data in that dataset (assumed) and attempt a compile-and-go with it.
As an example of Mainframe COBOL for a beginner, it is a poor one, as I can
count on the toes of one hand the number of times I've seen ACCEPT used in a
loop on the Mainframe. It is a common type of example for a beginners'
non-Mainframe COBOL course. It has been applied, by someone, to the Mainframe.
Yes, you could use TSO, but to what advantage? To see the magnificent GUI that
you can create? The options for input (which require that you code everything)?
The immediate problem, as has been mentioned, is the override "misses" (or
perhaps was not even attempted).
The wider issue is that ACCEPT (and DISPLAY) in IBM COBOLs are very simple.
Every other Vendor and their dog has Extended ACCEPT and DISPLAY - because they
don't run on Mainframes, and you need something other than punched cards to
communicate to the user with.
Mainframe training for batch COBOL needs to be about file processing.
Non-Mainframe training for COBOL needs to deal with the ACCEPT, DISPLAY (and
maybe SCREEN SECTION) of the implementation of COBOL being trained for.
The interest in this particular task is "you have to code it all yourself"
which is, in fact., a somewhat more advanced task than the example.
On Sunday, 10 July 2016 15:18:54 UTC+2, Keith Smith wrote:
> What is missing is a method of making the program "know" that you want it
> to get input from your screen. (or so it seems)
>
> If you want terminal input you need to use CICS or ISPF PANEL processing.
> Or possibly execute this program from TSO. It has been a while but I know
> of no way to tie a batch job to your terminal.
>
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN