|
VADELIA |
SADELIA |
|
MADELIA |
|
(I/B) (C/S) |
(B) (S) |
|
(I) (C/S) |
Warning: this instruction can be used in a batch program only for the *VARMSG mode.
Section for use
All
Syntax
SEND_MSG MsgNumOrAlphaVarId SeriesParameters Mode
SEND_MSG *CLR_ALL
SEND_MSG *CLR_OLD
MsgNumOrAlphaVarId |
Þ |
MsgNum | &AlphaVarId |
Mode |
Þ |
*BOX(Button, AnswerVarId DfltBtnRank) |
|
|
| *BOX(*OK) |
|
|
| *VARMSG(VarMsg) |
|
|
| None |
Button |
Þ |
*OK_CANCEL |
|
|
| *ABORT_RET_IGN |
|
|
| *YES_NO_CANCEL |
|
|
| *YES_NO |
|
|
| *RET_CANCEL |
|
|
|
DfltBtnRank |
Þ |
, 1 | , 2 | , 3 | None |
|
|
|
VarMsg |
Þ |
Level1VarMsgId | Level1VarMsgId, Level2VarMsgId |
Description
When *VARMSG mode is not used, this instruction displays a message in a message box in the center of the screen. This message box may or may not interrupt operations, depending on the Mode set.
The message identifier MsgNum is defined as 4 characters (message number) or as 7 characters (prefix + message number).
The variable AlphaVarId must be a seven-character alpha variable ( ALPHA(7) ) that contains the message's full name (prefix + number).
Parameters (data environment variable identification codes) can be specified if the message was defined with parameters.
If the mode is set to *BOX, the message box will interrupt the application until the user clicks on a button. *BOX mode is not permitted in server blocks. If *BOX mode is not set, all messages will be sent directly to an Adelia box displaying the list of messages.
The button type Button is used to determine the number and type of buttons to be displayed. These are described in the table below:
*OK |
OK button only |
*OK_CANCEL |
OK and Cancel buttons |
*ABORT_RET_IGN |
Abort, Retry and Ignore buttons |
*YES_NO_CANCEL |
Yes, No and Cancel buttons |
*YES_NO |
Yes and No buttons |
*RET_CANCEL |
Retry and Cancel buttons |
When *OK is selected, no variable AnswerVarId or value DfltBtnRnk is specified.
The variable AnswerVarId (numeric variable) retrieves the return code for the message box, i.e. the button selected by the user. The table below shows the various possible values:
Value |
Button activated |
*BTN_OK |
OK button |
*BTN_CANCEL |
Cancel button |
*BTN_ABORT |
Abort button |
*BTN_RETRY |
Retry button |
*BTN_IGNORE |
Ignore button |
*BTN_YES |
Yes button |
*BTN_NO |
No button |
The value DfltBtnRnk sets the rank of the button which will have the default focus (pre-selection) when the box is opened. The rank runs from left to right.
If *VARMSG mode is specified, the message is not displayed, but the level 1 message is placed in the alphanumerical variable Level1VarMsgId, and the level 2 message is placed in the alphanumerical variable Level2VarMsgId (if specified). When *VARMSG mode is used in a server part, the error message file corresponding to the server platform must be present in the server context. For the Windows and Java server parts, if the developer wishes to use a message in a given language, he needs to have set the server language via the VaToolBxSetServerLanguage function. On the other hand, for an AS/400 server part, the first error message file with the correct name in the library list is used so the one with the desired language must be put first.
If the *VARMSG mode is stipulated, the reserved word *RETURN_CODE is updated, making it possible to detect if the error message file has not been found or the message identifier does not exist (in the case of a dynamic call for example: SEND_MSG & MyAlpha7OfMessage...)
The instruction can also be used to clear the message list, by using *CLR_ALL to clear it entirely, or *CLR_OLD to clear only those messages that have already been displayed for the user.
Example
SEND_MSG MSG0001 ZCLIENT_CODE *BOX(*OK_CANCEL, BUTTON)
IF BUTTON = *BTN_CANCEL
SEND_MSG MSG0002 *BOX(*YES_NO, BUTTON, 1)
…
END
SEND_MSG MSG0002 *BOX(*OK)
SEND_MSG MSG0003 PARAM1
SEND_MSG MSG0003 PARAM1 *VARMSG(VARMSG1)
SEND_MSG MSG0004 *BOX(*YES_NO, RespMsg, 2)
* A message box is displayed to ask user to confirm record deletion
* NO button has rank number 2 and is the box default button
IF RespMsg = *BTN_YES
* variable RespMsg returns value from button that has been chosen
DELETE_SQL BOOKING *COND(BBOOKING_ID = :ZBOOK_ID)
IF *SQLCODE = *NORMAL
COMMIT
END
END
ALPHAVAR = 'MSG0002'
SEND_MSG &ALPHAVAR
* where ALPHAVAR is declared as ALPHA(7)