Message formats and logging versions
A message sent by an authorized user program must not exceed 31 Kbytes. Longer messages are rejected with REJ1
. Messages to be received by the user program thus also have a maximum size of 31 Kb plus the length of the possibly added header (see the NBMHE macro on "NBMHE macro"), since messages originating from other senders are in any case much smaller (for instance, the maximum length of a message output with MSG7X is 4 Kb).
The text of these messages always has the same format as for input and output at physical consoles (see previous chapter). Additional formats arise only if the authorized user program is acting as a server of a special operator command. These enhancements are described from "Special operator commands in authorized user programs" onwards.
However, pure text format is unsuitable for automatic evaluation of the messages received, since each individual piece of information, e.g. the value of a particular insert in a message, would first have be searched for in the text. The format of output texts is not, however, a guaranteed interface that will not alter when a version is changed.
The system thus makes it possible to exchange formatted messages with authorized user programs, which contain additional information other than text. This is controlled by the logging version that requests the authorized user program which establishes the connection to $CONSOLE. This procedure is different for connections under generated and dynamic authorization names, and is described in the corresponding sections on "Connections with generated authorization names". However, the meaning of the selected logging version is always the same.
Logging version 0
This represents the same declaration that the exchange of messages between the system and the authorized user program is restricted to message text in both directions. Additional information is not exchanged.
Logging version 1
If the authorized user program with the $CONSOLE interface declares logging version 1, the system still expects only text in known formats to be entered. When sending messages by the authorized user program there is thus no difference from logging version 0.However, the authorized user program receives messages from the system in expanded form, comprising a header, the text itself, as it would have been transmitted with logging version 0, and, if the message was one output with MSG7[X], a filler byte followed by a data-oriented description (“mapping format”) of the structure of the message.
A DSECT for describing the message header can be generated with the NBMHE macro, described below.
For the structure and contents of the data-oriented message description, see the description of the NBMAP macro on "NBMAP macro".
Logging version 2
If the authorized user program declares logging version 2 with the $CONSOLE interface, it receives all messages from the system in expanded form. As regards the receipt of messages by the authorized user program, there is thus no difference to logging version 1.Messages sent from the authorized user program to the system must, however, have the same expanded form; it is not sufficient merely to transmit the straightforward text.Generally, creating the message header for the authorized user program merely makes extra work (and sources of error), but entails no particular benefit. The only time it is necessary to user logging version 2 is if the authorized user program is to be used as a server for a manageable special operator command. The special features associated with this are described on "Special operator commands in authorized user programs".
NBMHE macro
The NBMHE macro defines the format of the message header. The Assembler interface has the following call format:
Macro | Operands |
|
|
Users are not permitted to specify VER=1!
The header has the following structure:
Parameter | V | DS | AT | LH | L2 | L1 | D | AK | SP | BC | RC2 | RC1 | FL | UID |
Apples for | 123 | 123 | 123 | 123 | 123 | 123 | 123 | 23 | 23 | 23 | 23 | 23 | 3 | 3 |
where:
V | Version number of the NBMHE macro which generates this structure; 1 byte |
DS | Dialog status byte; 1 byte |
AT | Job type; 1 byte |
LH | Length of the header; 2 bytes |
L2 | Displacement to the data-oriented section; 2 bytes |
L1 | Length of the text-oriented section; 2 bytes |
D | Message destination; 4 bytes |
Notes on individual fields
Most NBMHE fields are relevant only in particular contexts, as shown in the table. If the particular circumstance is not given, this means that when messages are received by the system, the field is uniformly undefined, and when messages are sent by the system, the contents of the field are not evaluated by the system, and so can be chosen at random.
For reasons of clarity, the logon dialog of the authorized user program dependent on the type of authorization name used is described separately, see "Connections with generated authorization names". The table relates to the exchange of messages - separate from the type of authorization name - after a connection has been successfully established (dialog status byte = 0).
V | Always relevant |
DS | Always relevant |
AT | Always relevant |
LH | Length of the header and simultaneous - since the text of the message follows directly on from the header - the displacement from the start of the message to the text. The field must correspond to the specified NBMHE version (i.e. 25 bytes for version 2, 34 bytes for version 3). To make sure it is also possible to work with future versions, the length must nevertheless be taken from the length field. |
L2 | (DLL2) Always relevant |
L1 D AK | (DLL1) Always relevant Only relevant for messages received Only relevant when receiving commands (AT = “ / ”) and additional command information (AT = “ : ”) and when sending messages as part of command handling (for details, see the relevant section on "Special operator commands in authorized user programs"). |
SP | Only relevant when sending messages |
BC | Only relevant if SP is not equal to zero (i.e. exclusively for system applications). |
RC2 | Only relevant for “command termination” messages (AT = “ ! ”). |
RC1 | Only relevant for “command termination” messages (AT = “ ! ”). |
FL | Only relevant when receiving commands (AT = “ / ”). |
UID | Only relevant when receiving commands (AT = “ / ”). |
The version number of the header should not be confused with the logging version number of the connection.
The field LH is at displacement X'03' in the header in all versions. It shows the displacement to the start of the following text, as this starts immediately after NBMHE.
NBMAP macro
The NBMAP macro defines the message trailer. The Assembler interface has the following call format:
Macro | Operands |
|
|
The structure is as follows:
|
|
|
| |||||||||||
V | MK | RC | WC | NI | INS0 | INS1 | INSn |
V | Version number of the NBMAP macro which generates this structure; 1 byte | |
MC | Message code; 7 bytes | |
RC | Routing code; 4 bytes (left-justified, remaining positions filled with 0) | |
WC | Weight of the message; 1 byte | |
NI | Number of inserts; 1 byte | |
IL | Length of current insert; 2 bytes | |
ID | Displacement of current insert from start of message text; 2 bytes | |
INS0 .... INSn | 0...n message inserts |
Example using the message header V02