:READ

Use the :READ script statement when you want retrieve data from the read buffer. The read buffer stores variables to make the values available for further processing. The function of the :READ statement depends on the context in which you use this script statement.

Important! Do not use text values with line breaks in the read buffer. :READ ignores the characters after the first line break.

Reading Variables in the Read Buffer

Use the :READ statement to retrieve the following data from the read buffer:

To Read Data Stored in the Read Buffer

Store a script variable in the read buffer with a :PUT_READ_BUFFER statement. Activate an object with the ACTIVATE_UC_OBJECT function. Retrieve the value of the variable that you stored in the read buffer with a :READ statement. Each script variable in the buffer can only be read once. The variable is deleted from the buffer after reading..

Example

The following example stores the name of the agent of a Job in the read buffer, and activates a Notification object.

:SET &att_host# = GET_ATT(HOST)
:
PUT_READ_BUFFER host# = '&att_host#'

:SET &ret# = ACTIVATE_UC_OBJECT('CALLOP')

In the Notification object, the following script retrieves the agent name stored by the previous script:

:READ &host#,,

:PRINT "Agent: &host#"

The following example is a script in a Notification object. The script reads UC_CAUSE* variables to retrieve the details of the task that activated the Notification. The script prints the details of task in the activation report:

:READ &UC_CAUSE_NAME,,
:
READ &UC_CAUSE_NR,,
:
READ &UC_CAUSE_STATE,,
:
READ &UC_CAUSE_RETCODE,,

:PRINT "This notification was triggered by the following task:"
:PRINT "Name: &UC_CAUSE_NAME"
:PRINT "RunID: &UC_CAUSE_NR"
:PRINT "Status: &UC_CAUSE_STATE"
:PRINT "Return code: &UC_CAUSE_RETCODE"

:READ User Dialogs

Write the :READ statement between a :BEGINREAD and :ENDREAD statement to trigger a request and display it in the Requests view for user input. The data the user enters is stored in variables and can be used for further processing. For more information, see Requests.

:READ statements only trigger a request if one if the following is true:

:READ statements do not trigger a request in the following situations, and the default values are used instead:

Tip: Use the GET_ATT script function with the DCMODUS attribute to determine whether a script is running in a mode that will permit the Requests view to be displayed. For more information, see GET_ATT.

The report automatically logs values that are entered in the request. You can deactivate this behavior for Job reports in the parameters of the script statement.

To Read User Input from the Read Buffer

Write the :READ statement in an enclosing :BEGINREAD...:ENDREAD block to query the user and store the values in the read buffer.

Syntax

:REA[D] InVariable, [Input Check], [Message Text] [, Default Value] [, Input Handling]

Parameters

Important!

Notes:

The request displays the object name in the title bar. Use the script statement parameters to define the appearance and content of the request.

Examples

The script in the following example creates a request that queries the user for a headline. The input that the user enters is not validated, and the user can also leave the field blank. The characters are immediately converted to uppercase letters.

:READ &HEADLINE#,"00","Please enter headline"

The following example also queries the user for a headline. The request does not suggest a default value, and does not validate input. Entering lowercase letters is possible.

:READ &HEADLINE#,,,,"K"

The following example queries the user for a number. The Input Handling option is set to N, so the request contains a number field. Only numbers from 0 to 5 are accepted.

:READ &NUMBER#,"0-5","Please enter number",,"N"

The following example queries the user for a date. The input has to be a valid date in the format YYMMDD, and cannot be blank.

:READ &DATE1#,"YYMMDD","Please specify a date (YYMMDD)",,"M"

The following example queries the user for a signature. The default value in the input field is A. The value entered in the field is validated to check whether it matches the allowed values of A, X and numbers between 5 and 9.

:READ &LKZ#,"A,X,5-9","Please enter List Signature","A"

The following example requests the user to enter a password with a maximum of 8 characters. The Input Handling options D, M, and K determine that the field is secured, letters are not converted to uppercase, and the field cannot be left blank, respectively.

:READ &PASS#,"08","Please enter password (max. 8 characters)",,"DMK"

The following example requests the user for an email address. The user can pick from a selection of three email addresses. To avoid the hyphen being interpreted as a range of values, the last address is written in single quotation marks.

:READ &USER#,"brown@automic.us,johnson@automic.us,'smith@late-night.com'", "Please select user"

The following example requests the user to select an address, or enter a new one.

:READ &USER#,"brown@automic.us,johnson@automic.us,'smith@late-night.com'", "Please select user",,"O"

See also:

seealso

Notification (CALL)

PromptSets (PRPT)

:PUT_READ_BUFFER