Function sys_get_errorlevel

Errorlevel is an internal error code that is maintained by the JCL module. Normally the Errorlevel will be zero if all function calls have completed successfully. The sys_get_errorlevel function allows you to examine the current state of the Errorlevel variable.

Parameters

None

Returns

The current Errorlevel.

Examples

This example shows how you might obtain the current Errorlevel while your job is running.

Example 1
 my $errlvl = sys_get_errorlevel();
 log_info( "Errorlevel: $errlvl );
 # or
 log_info( 'Errorlevel: ' . sys_get_errorlevel() );

Normally you should end all jobs with a call to this function so the operating system receives an indication of the job’s completion status.

Example 2
 sys_end();
 exit sys_get_errorlevel();

Notes

It is good practice to end your job with a call to this function so the operating system can be notified of the job’s exit status. Notice the call to sys_end immediately prior to the call to sys_get_errorlevel. This is a best practice for JCL jobs.

See Also