IBM Books

Net.Data Reference Guide

MESSAGE Block

Purpose

The MESSAGE block specifies messages to display and recommended actions to take based on the return code from a function.

A set of return codes, along with their corresponding messages and recommended actions are defined in the MESSAGE block. When a function call completes, Net.Data compares its return code with return codes defined in the MESSAGE block. If the function's return code matches one in the MESSAGE block, Net.Data displays the message and evaluates the recommended action to determine whether to continue processing or exit the Net.Data macro.

A MESSAGE block can be global in scope, or local to a single FUNCTION block. If the MESSAGE block is defined at the outermost macro layer, it is considered global in scope. When multiple global MESSAGE blocks are defined, only the last block is considered active. If the MESSAGE block is defined inside a FUNCTION block, the block is local in scope to the FUNCTION block where it is defined. See "Message Blocks" in the Net.Data Programming Guide for return code processing rules.

Syntax

>>-%message--{-------------------------------------------------->
 
   +---------------------------------------------------------------------------+
   V                                                                           |
>----+-----------------------------------------------------------------------+-+->
     +-| return code spec |--:--| message text spec |--+------------------+--+
                                                       +-| action spec |--+
 
>-%}-----------------------------------------------------------><
 
return code spec
 
|--+-DEFAULT-------+-------------------------------------------|
   +- +DEFAULT-----+
   +- -DEFAULT-----+
   +-+---+-number--+
     +---+
     +-+-+
 
message text spec
 
         +-----------------------+
         V                       |
|---+-"----+--------------------++--"---+----------------------|
    |      +-string-------------+       |
    |      +-variable reference-+       |
    |      +-function call------+       |
    |    +-----------------------+      |
    |    V                       |      |
    +-{----+--------------------++--%}--+
           +-string-------------+
           +-variable reference-+
           +-function call------+
 
action spec
 
|--:--+-EXIT-----+---------------------------------------------|
      +-CONTINUE-+
 

Parameters

%message

A keyword for the block that defines a set of return codes, the associated messages, and the actions Net.Data takes when a function call is returned.

return_code spec:

A positive or negative integer. If the value of the Net.Data RETURN_CODE variable matches the return_code spec value, the remaining information in the message statement is used to process the function call. You can also specify messages for return codes not specifically entered in the $MESSAGE block.

DEFAULT

A keyword used to specify a default message code. If RETURN_CODE does not equal zero (0), and an exact match is not specified, the information in this message statement is used to process the function call.

+DEFAULT

A keyword used to specify a default negative message code. If RETURN_CODE is less than zero (0), and an exact match is not specified, the information in this message statement is used to process the function call.

-DEFAULT

A keyword used to specify a default positive message code. If RETURN_CODE is greater than zero (0), an exact match is not specified, and the +DEFAULT (for RETURN_CODE greater than 0) or -DEFAULT (for RETURN_CODE for less than 0) value is not specified, the information in this message statement is used to process the function call.

number

The message code that specifies errors and warnings that can occur during processing. A string of numerical digits from 0 to 9.

message text spec

A string that is sent to the Web's browser if the RETURN_CODE matches the return_code value in this message's message statement.

string

Any sequence of alphabetic and numeric characters and punctuation except a tabulator, newline character, or a space.

variable reference

Returns the value of a previously defined variable and is specified with $ and (). For example: if VAR = 'abc', then $(VAR) returns the value 'abc'. See Variable Reference for syntax information.

function call

Invokes one or more previously defined FUNCTION blocks with specified arguments. See Function call (@) for syntax and examples.

action spec:

Determines what action Net.Data takes if the RETURN_CODE matches the return_code value in this message's message statement.

EXIT

A keyword that specifies to exit the macro immediately when the error or warning corresponding to the specified message code occurs.

CONTINUE

A keyword that specifies to continue processing when the error or warning corresponding to the specified message code occurs.

Context

Can be found in these contexts:

Restrictions

Can contain these elements:

Examples

Example 1:

%MESSAGE{
-601: {<H3>The table has already been created, please go back and enter your name.</H3>
<P><a href="input">Return</a>
%}
default: "<H3>Can't continue because of error $(RETURN_CODE)</H3>"
%}

Example 2:

%{ global message block %}
%MESSAGE {
   -100     : "Return code -100 message"   : exit
    100     : "Return code 100 message"    : continue
   +default : { 
This is a long message that spans more
than one line. You can use HTML tags, including
anchors and forms, in this message. %}   : continue
%}
 
%{ local message block inside a FUNCTION block %}
%FUNCTION(DTW_REXX) my_function() {
  %EXEC { my_command.cmd %}
  %MESSAGE {
     -100     : "Return code -100 message"   : exit
      100     : "Return code 100 message"    : continue
     -default : { 
This is a long message that spans more
than one line. You can use HTML tags, including
anchors and forms, in this message. %}   : exit
  %}


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]