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
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
%}