omron — STATUS real-valued function

STATUS real-valued function A program is considered write-interlocked when it is being copied, deleted, renamed, or edited in read-write mode. A program is considered read-interlocked when it is executing (by one or more tasks) or is being edited in read-only mode. A program is considered not executable when it contains a structure error or a bad line. NOTE: If a program is being executed by multiple tasks, the STATUS function returns -5. There is no way to use the STATUS function to determine when the program ceases to be executed by one of those tasks. The STATUS function does not return -1 until all the tasks stop executing the program.

The function returns a not defined status if an invalid program name is specified (for example, if the name does not start with a letter). Example The following program segment demonstrates how the STATUS function can be used to decide whether or not to initiate execution of an application program: IF STATUS("pc.main") == -1 THEN EXECUTE 1 pc.main END NOTE: The STATUS function does not return -1 if the program is being executed by any program task. Thus, this example may not be appropriate for some situations.

(See the example shown for the EXECUTE instruction for another technique for initiating execution of another program task.) Related Keywords DEFINED real-valued function STATE real-valued function STATUS monitor command TESTP monitor command eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 508 Value returned Program status -4 Not executable. -5 Interlocked because of read.