7.45.1 ENDCHECK Parameters

IF_ERROR

MSGDTA

MSGF

MSGID

MSGTXT

IF_ERROR

Specifies what action is to be taken if one or more of the validation commands inside the validation block find a validation error. The validation check commands used inside a validation block include CONDCHECK, RANGECHECK, VALUECHECK, CALLCHECK and DATECHECK.

A validation error occurs within a validation block when one or more of the validation commands detects a condition that has an "action" of *ERROR specified. Refer to the validation commands for more details of how and when the *ERROR "action" is specified in a validation command.

In addition, a validation error can also be caused by the execution of a SET_ERROR command within the validation block. This usually occurs when user written validation logic is being used rather than one of the 6 standard validation check commands.

Finally, a validation error can be caused by the execution (within the validation block) of any database I/O command that receives a "VE" (validation error) return code. Validation errors are normally only received by the INSERT, UPDATE and DELETE database I/O commands.

*LASTDIS, which is the default value, specifies that control should be passed back to the last display screen used. The field(s) that failed the validation check(s) within the validation block or had a SET_ERROR command executed against them will be displayed in reverse image and the cursor positioned to the first field in error on the screen.

*NEXT indicates that control should be passed to the next command.

*RETURN specifies that in a program mainline control is to be returned to the caller and in a subroutine control is to be returned to the caller routine or the program mainline.

If none of the previous values are used you must nominate a valid command label to which control should be passed.

Note that *LASTDIS is valid even if there is no "last display" (such as in batch functions). In this case the function will abort with the appropriate error message(s).

MSGTXT

Allows up to 80 characters of message text to be specified. The message text specified should be enclosed in quotes. Use either the MSGTXT parameter or the MSGID / MSGF parameters but not both.

MSGID

Allows a standard message identifier to be specified as the message that should be used. Message identifiers must be 7 characters long. Use this parameter in conjunction with the MSGF parameter.

MSGF

Specifies the message file in which the message identified in the MSGID parameter will be found. This parameter is a qualified name. The message file name must be specified. If required the library in which the message file resides can also be specified. If no library name is specified, library *LIBL is assumed.

MSGDTA

Use this parameter only in conjunction with the MSGID and MSGF parameters. It specifies from 1 to 20 values that are to be used to replace "&n" substitution variables in the message specified in the MSGID parameter.

Values in this parameter may be specified as field names, an expandable group expression, alphanumeric literals or numeric literals. They should exactly match in type, length and specification order the format of the substitution variables defined in the message.

When a field specified in this parameter has a type of signed (also called zoned) decimal, the corresponding "&n" variable in the message should have type *CHAR (character). This may cause a problem when dealing with negative values. In this case use packed decimal format instead.

When an "&n" variable in the message has type *DEC (packed decimal) the field specified in this message must be of packed decimal type.

When using alphanumeric literals in this parameter, remember that trailing blanks may be significant. For instance, if a message is defined as

"&1 are out of stock ... reorder &2"

where &1 is defined as (*CHAR 10) and &2 as (*DEC 7 0), then the message will NOT be issued correctly if specified like this:

MSGDTA('BOLTS' #ORDQTY)

or like this

MSGDTA('BOLTS     ' #ORDQTY)

To make LANSA aware of the trailing blanks, the parameter must be specified like this:

MSGDTA('''BOLTS     ''' #ORDQTY)

When expandable expressions are used, the expanded field list must not exceed the maximum number of substitution variables allowed in the parameter.