ITEM: E5342L

Can you use nohup to ignore Ctrl-C in a COBOL program?


Question:

I know that nohup will work for AIX commands and shell scripts.

I would like to be able to run COBOL programs and not allow the
users to use Ctrl-C to interrupt the programs.

Will nohup work in this scenario?  If not, how can I set this up?

Response:

Yes, the nohup command will work with a COBOL program in the
same way it works with AIX commands and scripts.  nohup will
allow you to run the command without hangups (SIGHUP) and quits
(SIGQUIT).  For example, if you have a cobol program cob1.cbl
that has been compiled to an .int file you could run it with
nohup in the following manner:

  nohup cobrun cob1 [&]

Then any SIGHUPs or SIGQUITs sent to cob1 will be ignored.

Unfortunately, Ctrl-C sends the signal SIGINT and this is not 
ignored when using nohup.  To ignore Ctrl-C you will need to add 
this capability to your COBOL application.

Micro Focus COBOL supplies a library routine that disables the 
interrupt key.  It is accessed by calling X"B0" in the following 
manner:

  CALL X"B0" USING FUNCTION-CODE PARAMETER.

where FUNCTION-CODE is a PIC X COMP-X VALUE 4 data item
  and PARAMETER     is a PIC X COMP-X VALUE 1 data item.

CALL X"B0" disables the interrupt key (Ctrl-C) for the rest of the 
application.  Therefore, it should be called before any subprograms
are called.


Support Line: Can you use nohup to ignore Ctrl-C in a COBOL program? ITEM: E5342L
Dated: October 1993 Category: N/A
This HTML file was generated 99/06/24~13:30:53
Comments or suggestions? Contact us