PRINTERR statement

Syntax

PRINTERR [error.message]

Description

Use the PRINTERR statement to print a formatted error message on the bottom line of the terminal. The message is cleared by the next INPUT statement @ statement or is overwritten by the next PRINTERR or INPUTERR statement. PRINTERR clears the type-ahead buffer.

error.message is an expression that evaluates to the error message text. The elements of the expression can be numeric or character strings, variables, constants, or literal strings. The null value cannot be an element because it cannot be output. The expression can be a single expression or a series of expressions separated by commas ( , ) or colons ( : ) for output formatting. If no error message is designated, a blank line is printed. If error.message evaluates to the null value, the default message is printed:

Message ID is NULL: undefined error

Expressions separated by commas are printed at preset tab positions. The default tab stop setting is 10 characters. For information about changing the default setting, see the TABSTOP statement. Use multiple commas together to cause multiple tabulations between expressions.

Expressions separated by colons are concatenated: that is, the expression following the colon is printed immediately after the expression preceding the colon.

See also the INPUTERR statement.

REALITY Flavor

In a REALITY flavor account the PRINTERR statement prints a formatted error message from the ERRMSG file on the bottom line of the terminal. REALITY syntax is:

 PRINTERR [dynamic.array] [FROM file.variable]

dynamic.array must contain a record ID and any arguments to the message, with each element separated from the next by a field mark. If dynamic.array does not specify an existing record ID, a warning message states that no error message can be found.

If dynamic.array evaluates to the null value, the default error message is printed:

Message ID is NULL: undefined error

The FROM clause lets you read the error message from an open file. If file.variable evaluates to the null value, the PRINTERR statement fails and the program terminates with a run-time error message.

This statement is similar to the STOP statement on a Pick system except that it does not terminate the program upon execution. You can use it wherever you can use a STOP or ABORT statement.

To use the REALITY version of the PRINTERR statement in PICK, IN2, INFORMATION, and IDEAL flavor accounts, use the USE.ERRMSG option of the $OPTIONS statement.

InfoSphere® DataStage® provides a standard Pick ERRMSG file. You can construct a local ERRMSG file using the following syntax in the records. Each field must start with one of these codes, as shown in the following table:

Table 1. ERRMSG File Codes
Code Action
A[(n)] Display next argument left-justified; n specifies field length.
D Display system date.
E [string] Display record ID of message in brackets; string displayed after ID.
H [string] Display string.
L [(n)] Output newline; n specifies number of newlines.
R [(n)] Display next argument right-justified; n specifies field length.
S [(n)] Output n blank spaces from beginning of line.
T Display system time.