Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

bs2exit - Program termination with MONJV

&pagelevel(4)&pagelevel

Definition

#include <stdlib.h>

void bs2exit(int status, const char *monjv_rcode);

bs2exit terminates the program.
Before this is done, all files opened by the program are closed, and the following messages are output to stderr:

  • “CCM0998 used CPU-time t seconds”, if CPU-TIME=YES is set in the RUNTIME option

  • “CCM0999 exit status”, if status != EXIT_SUCCESS (value 0)

  • "CCM0999 exit FAILURE", if status = EXIT_FAILURE (value 9990888).

The status indicator of the monitoring job variable (1st to 3rd byte) is set to the value "$T " or "$A " in accordance with the first status parameter.

The return code of the MONJV (4th - 7th byte) can additionally be supplied with the monjv_rcode parameter.

Parameters

int status

see exit function.

const char *monjv_rcode

This parameter can be used to specify a pointer to 4 bytes of data (the return code), which is loaded in the MONJV when the program terminates.

Notes

When a program is terminated with bs2exit the termination routines registered with atexit are not called (cf. exit).

In order to set and query monitor job variables, you must start the C program with the following command:

/START-PROG program,MONJV=monjvname

The content of the job variable can then be queried, e.g. with the following command:

/SHOW-JV JV-NAME(monjvname)

Further information on job monitoring using MONJV can be found in the "Job Variables" manual.

Example

The program is terminated and the return code is set

#include <stdio.h>
int main(void)
{
  ...
  if(fehler)
    bs2exit(-1, "ABCD");
}

see also

exit, _exit