# STAT= and ERRMSG= Specifiers in Image Control Statements

If the STAT= specifier appears in an image control statement, successful execution of the statement causes the specified variable to become defined with the value zero. In a given image control statement, the stat-var in a STAT= specifier, the err-var in an ERRMSG= specifier, the log-var in an ACQUIRED_LOCK= specifier, and an event variable or lock variable must not depend on one another.

If the STAT= specifier appears in an EVENT WAIT or a SYNC MEMORY statement and an error occurs, stat-var is defined with a processor-dependent positive value that is different from the value of STAT_STOPPED_IMAGE or STAT_FAILED_IMAGE.

The images involved in the execution of an END TEAM, FORM TEAM, or SYNC ALL statement are the images of the current team. The images involved in the execution of a CHANGE TEAM or SYNC TEAM statement are those of the specified team.The images involved in the execution of a SYNC IMAGES statement are the specified images and the image executing the SYNC IMAGES statement. The images involved in the execution of an EVENT POST statement are the image executing the statement and the image on which the event variable is located.

If the STAT= specifier appears in a CHANGE TEAM, END TEAM, EVENT POST, FORM TEAM, SYNC ALL, SYNC IMAGES, or SYNC TEAM statement and execution of one of these statements involves synchronization with an image that has initiated normal termination, the variable becomes defined with the value of the constant STAT_STOPPED_IMAGE in the intrinsic module ISO_FORTRAN_ENV. Otherwise, if no other error condition occurs and one of the involved images has failed, the STAT= specifier becomes defined with the value STAT_FAILED_IMAGE in the intrinsic module ISO_FORTRAN_ENV. If any other error condition occurs during execution of one of these statements, the variable becomes defined with a processor-dependent positive integer value that is different from the value of STAT_STOPPED_IMAGE or STAT_FAILED_IMAGE.

If the STAT= specifier appears in a SYNC ALL, SYNC IMAGES, or SYNC TEAM statement and the error STAT_STOPPED_IMAGES occurs, the effect of executing the statement is the same as that of executing the SYNC_MEMORY statement.

If the STAT= specifier appears in a LOCK statement and the lock variable is located on an image that has failed, the specified variable becomes defined with the value STAT_FAILED_IMAGE. If the lock variable is locked by the executing image, the specified variable becomes defined with the value of STAT_LOCKED. Otherwise, if the lock variable is unlocked because the image that locked it has failed, the specified STAT= variable becomes defined with the value STAT_UNLOCKED_FAILED_IMAGE defined in the intrinsic module ISO_FORTRAN_ENV.

If the STAT= specifier appears in an UNLOCK statement and the lock variable is located on an image that has failed, the specifier becomes defined with the value STAT_FAILED_IMAGE. Otherwise, if the lock variable has the value unlocked, the variable specified by the STAT= specifier becomes defined with the value of STAT_UNLOCKED. If the STAT= specifier appears in an UNLOCK statement and the lock variable is locked by a different image, the specified variable becomes defined with the value STAT_LOCKED_OTHER_IMAGE. The named constants STAT_LOCKED, STAT_UNLOCKED, and STAT_LOCKED_OTHER_IMAGE are defined in the intrinsic module ISO_FORTRAN_ENV.

If any other error condition occurs during execution of a LOCK or UNLOCK statement, the specified variable becomes defined with a positive integer value that is different from STAT_LOCKED, STAT_UNLOCKED, STAT_UNLOCKED_FAILED_IMAGE, and STAT_LOCKED_OTHER_IMAGE.

If an image completes execution of a CRITICAL statement that has a STAT= specifier and the previous image that entered the CRITICAL construct failed during execution of the construct, the specifier becomes defined with the value STAT_FAILED_IMAGE and the execution of the construct executes normally. If any other error occurs during execution of the construct, the specifier becomes defined with a positive integer value other different from STAT_FAILED_IMAGE.

If an error condition occurs during execution of an image control statement that does not contain the STAT= specifier, error termination is initiated.

If an ERRMSG= specifier appears in an image control statement, and an error condition occurs during execution of that statement, the processor will assign an explanatory message to the specified variable. If no such condition occurs, the processor will not change the value or definition status of the variable.

The set of error conditions that can occur during execution of an image control statement is processor dependent.

Parent topic: Image Control Statements

## See Also

ISO_FORTRAN_ENV Module