NET/MASTER Network Control Language (NCL) Programmer's Guide

The Structure of Mapped Data Object (MDO) Variables
Working With Mapping Services
106160 Tandem Computers Incorporated 10–13
The length field of an element header contains internal Mapping Services data. You
cannot directly access the length field of an element header from an NCL procedure.
However, the following NCL procedure shows how you can use the LENGTH built-in
function to indirectly access the length of an element:
zex1005n: PROCEDURE
/* MSGPROC procedure to obtain element length */
DO FOREVER
MSGREAD VARS=&word*
IF &word1 = "TEST" THEN DO
/* Get length and add 4 bytes */
&length = LENGTH( &$MSG.TEXT ) + 4
SAY "Length of &$MSG.TEXT is "&length" bytes "
MSGCONT
END
ELSE
MSGCONT
END
END zex1005n
The NCL procedure adds 4 bytes to the value obtained by the LENGTH built-in
function to include the length of the element header as part of the total length of the
element. Using this technique requires an understanding of the data structure of an
element.
After following the steps outlined earlier in this section to type this NCL procedure
and install it as your active MSGPROC procedure, execute the ZEX1002N NCL
procedure to send a message to your OCS window. The following screen shows the
results of executing ZEX1002N with MSGPROC active:
(06:54) --------------------- OPERATOR CONTROL SERVICES ----------------------
PROFILE MSGPROC=ZEX1005N
NNM0393 MSGPROC PROCESSING ACTIVATED
NNM0357 PROFILE HAS CHANGED
START ZEX1002N
TEST An OPER NRD message
Length of &$MSG.TEXT is 28 bytes
NNM1005 START ZEX1002N PROCESSING COMPLETE. NCLID 001015
_____________________________________________________________________________
---------- ------------------ NonStop NET/MASTER D30 ---------------- --------
M=>