Using HZSMGB data area format MGBFORMAT=1

 1  shows an example of defining the message number in the MGB1_MessageNumber field.

 2  shows an example of filling in the MGB1_Insert_Cnt field with the number of variables for your message.

 3  shows examples of defining the length and address of the variable in the MGB1_MsgInsertDesc_Length and MGB1_MsgInsertDesc_Addr fields for the variable in storage. These fields are in the MGB1_MsgInsertDesc mapping.

 4  shows an example of issuing a message. Note that this example shows a local message. For a remote check, the HZSFMSG macro must include the REMOTE=YES, HANDLE=handle, and MSGTABLE=msgtable parameters.

 5  shows how the variable address, length, and value are defined to be stored in the HZSMGB data area or in storage.

 6  shows an example of creating an area big enough in the HZSMGB1 for the information about all your variables. To create enough room for all your variables, use the formula HZSMGB1_LEN1 + (n)*MGB1_MsgInsertDesc_Len where n is the number of inserts.

Figure 1 shows check routine code that defines variable data in the HZSMGB data area using MGBFORMAT=1:
Figure 1. Example of issuing a message with variables using MGBFORMAT=1
************************************************************* 
* Issue a message with two inserts                          * 
************************************************************* 
         SYSSTATE ARCHLVL=2 
* save regs, get dynamic storage, chain saveareas, set usings 
         LA 2,TheMGBArea 
         ST 2,TheMGBAddr 
         USING HZSMGB1,2  1    MVC   MGB1_MessageNumber,=F’1’ Message 1  2    MVC   MGB1_insert_cnt,=F’2’ Two inserts 
         DROP  2
         PUSH  USING
         USING MGB1_MsgInsertDesc,TheMSGInsertDesc1 3    MVC   MGB1_MsgInsertDesc_Length,=AL2(L’Insert1Val) Insert length 
         LA    15,Insert1Val
         ST    15,MGB1_MsgInsertDesc_Addr  Insert address
         POP   USING
         PUSH  USING
         USING MGB1_MsgInsertDesc,TheMGBInsertDesc2
         MVC   MGB1_MsgInsertDesc_Length,=AL2(L’Insert2Val) Insert length 
         LA    15,Insert2Val
         ST    15,MGB1_MsgInsertDesc_Addr  Insert address 
         POP   USING 4       HZSFMSG REQUEST=CHECKMSG,MGBADDR=TheMGBAddr,                      * 
               MGBFORMAT=1,                                                *  
               RETCODE=LRETCODE,RSNCODE=LRSNCODE,                          * 
               MF=(E,FMSGL) 
* 
* Place code to check return/reason codes here 
* 
* free dynamic storage, restore regs 
         BR    14  5 
* Area for first insert 
Insert1Val DC C’CSA ’ 
* Area for second insert
Insert2Val DC X'00950000'
         LTORG , 
         HZSZCONS , Return code information 
         HZSMGB , Insert mapping 
DYNAREA  DSECT 
LRETCODE DS F 
LRSNCODE DS F 
TheMGBAddr DS A
* Area for 2 inserts     6 
TheMGBArea     DS CL(HZSMGB_LEN1)
TheMSGInsertDesc1  DS CL(MGB1_MsgInsertDesc_Len) 
TheMSGInsertDesc2  DS CL(MGB1_MsgInsertDesc_Len)
HZSFMSG  MF=(L,FMSGL),PLISTVER=MAX 
DYNAREA_LEN EQU *-DYNAREA 

Important MGBFORMAT=1 fields in the HZSMGB data area include:

Table 1. Important MGBFORMAT=1 fields in the HZSMGB data area for check message variables
Field name Meaning

MGB1_MessageNumber
MGB1_ID

Fullword field containing the value identifying each message. These fields are the same - there are two names for this field. This field corresponds to the xreftext value for each message. For example, the xreftext value for a message is coded as follows:
<msgnum xreftext="001">TESTMSG1I</msgnum>
MGB1_InsertCnt Fullword field containing the number of variables (or inserts) to follow.

MGB1_MsgInsert
Desc_Length

The length of the variable. For a null variable, use a length of zero.

MGB1_MsgInsert
Desc_Addr

The address of the variable. For a null variable, you need not set this field.