I have a very long running COBOL program that runs randomly at various times during the day. The Console operator wants to be notified when it starts up and have the program wait so they can go get coffee before letting the job go ahead. How can I do this with COBOL?
In Mainframe COBOL, How Can I Send a Message to the Console Operator, Wait for a Response, Then Continue?
Asked Answered
Alas, the Mainframe Documentation project I'm trying to join is here: :-( stackoverflow.com/documentation/mainframe I only need about 25 more points to qualify and then I'll be done here. Can you upvote me? –
Jimmiejimmy
Use the COBOL 'STOP' statement, like this:
IDENTIFICATION DIVISION.
PROGRAM-ID. SAMPLE.
PROCEDURE DIVISION.
STOP 'GO GET COFFEE'
* program waits until operator responds
DISPLAY 'PROGRAM WILL NOW CONTINUE'
* program now continues
* [...]
GOBACK.
As always, check with your technical staff before coding something like this. –
Rent
And you could DISPLAY ... UPON CONSOLE then ACCEPT ... FROM CONSOLE and even use the response. But, just because it can be done, doesn't mean it is a good idea. –
Stephaniestephannie
I'd also recommend
ACCEPT
over STOP literal
because STOP literal
was deleted from standard COBOL over 30 years ago. Even IBM recommend against it in the COBOL for z/OS manual. –
Berryman © 2022 - 2024 — McMap. All rights reserved.