Previous Topic: Batch-Control Event ConditionNext Topic: Comparison Condition


Command Status Condition

Purpose

Tests a dialog's error-status field for the presence of a specified status code, following the execution of a process command that involves database, queue, or scratch activity, or a WRITE PRINTER utility command.

The command status is checked by testing the error-status field for a specified status code or by testing a level-88 condition name. Level-88 condition names and status field names other than ERROR-STATUS must be defined in the dialog's status definition record.

Syntax

►►───┬── error-status-code-name ────┬───────────────────┬──────────────────┬──►◄
     │                              └─ FOR record-name ─┘                  │
     │                                                                     │
     └┬─ ERROR-STATUS ──────────┬─ comparison-operator  error-status-code ─┘
      └─ status-field-variable ─┘

Parameters

error-status-code-name:

The name of a level-88 condition defined in the dialog's status definition record.

FOR record-name:

Specifies that the test applies to the last database command involving the named record.

Record-name must be known to the dialog's subschema.

ERROR-STATUS

Represents the value contained in the internal error-status field for the dialog.

status-field-variable

Specifies the name of a user-supplied data field that contains the error-status field for the dialog.

Status-field-variable must be defined in the dialog's status definition record.

comparison-operator:

The comparison operators are:

Operator

Synonym

Meaning

EQ

=

Equal

NE

 

Not equal to

GT

>

Greater than

LT

<

Less than

GE

 

Greater than or equal to

LE

 

Less than or equal to

error-status-code:

Specifies the status code to which the value in status-field-variable is compared.

Error-status-code is:

Example 1: Testing for a database record status

The command status condition in the following IF statement is true when the dialog's error-status field contains the status code 0326:

IF DB-REC-NOT-FOUND THEN ...

DB-REC-NOT-FOUND must be defined in the dialog's status definition record.

Example 2: Testing for the end-of-set

The command status condition in the following IF statement is true when the dialog's error-status field does not contain the status code 0307:

IF NOT DB-END-OF-SET THEN ...

DB-END-OF-SET must be defined in the dialog's status definition record.

Example 3: Testing for the status of a database record

The command status condition in the following IF statement is true when the dialog's error-status field contains the status code 0000 following execution of the most recent command involving a CUSTOMER record:

IF DB-STATUS-OK FOR CUSTOMER THEN ...

DB-STATUS-OK must be defined in the dialog's status definition record.

Example 4: Testing for a dialog's error status

The command status condition in the following IF statement is true when the dialog's error-status field contains the status code 0307:

IF ERROR-STATUS IS '0307'...

More information:

Error Handling