CL commands and thread safety

The Integrated Language Environment® (ILE) CL run time and compiler-generated code are threadsafe. Original program model (OPM) CL programs are not threadsafe.

For any ILE CL code that is compiled before Version 4 Release 3 or any OPM CL code, the CL run time sends a CPD000B diagnostic message and continues to run with unpredictable results. This might or might not be threadsafe, depending on the underlying code.

Command analyzer is threadsafe. For a given command, if the threadsafe attribute (THDSAFE) is *NO and the multithreaded job action attribute (MLTTHDACN) is set to *NORUN or *MSG, the command analyzer does one of the following when such a command is called in a job capable of multithreaded operations:

If MLTTHDACN is set to *RUN, the command analyzer does not send a diagnostic message and allows the command to run. The results of this are unpredictable. Also, MLTTHDACN only applies to comments whose THDSAFE value is *NO. To determine the THDSAFE and MLTTHDACN values for a command, use Display Command (DSPCMD).

The MLTTHDACN value of some commands is set to *SYSVAL. In this case, command analyzer uses the QMLTTHDACN system value to decide how to process the command.

To display the setting of this value on i5/OS™:

DSPSYSVAL SYSVAL(QMLTTHDACN)

To change the setting of this value on i5/OS:

CHGSYSVAL SYSVAL(QMLTTHDACN) VALUE(x)

Sample output from DSPSYSVAL:
 Display System Value 

 System value . . . . . : QMLTTHDACN 
 Description . . . . . : Multithreaded job action 


 Multithreaded job 
 action . . . . . . . : 2 
 1=Perform the function that is not 
 threadsafe without sending a message 
 2=Perform the function that is not 
 threadsafe and send an informational 
 message 
 3=Do not perform the function that is 
 not threadsafe 
Related concepts
Multithreaded programming techniques
Function calls that are not thread safe