SNAX/HLS Application Programming Manual

SCOBOLX Applications
SNAX/HLS Programming Standards
1–16 104707 Tandem Computers Incorporated
The following fragment of code illustrates how your program might extract the
characters, given a verb-code value of vb. Note, in particular, how the example tests
the value for legal ranges and uses the string width as defined by the literal.
IF vb >= verb^^first AND vb <= verb^^last THEN
BEGIN
index := (vb - verb^^first) * verb^^width;
Desired^Answer ':=' verb^^nams[ index ] FOR
verb^^width;
END;
Note that Desired^Answer, (the recipient of the string) should be declared with the
capability of holding a string of the size defined by the string width literal.
Note Since LITERAL VERB^^WIDTH is not in the VERB^NAMS section, you must source section
VERB^CODE^DEFINITIONS for this example to work.
Section DT^NAMS
Use the following statement to include the DT^NAMS section of the copybook in your
program:
?source HLSDDT(dt^nams)
This section defines the names (not the values) of the various SNAX/HLS data-type
codes. Its primary use is to enable your program to convert data-type values into the
standard name (without the DT^ prefix and with all circumflexes [^] converted to
underscores). The data structure itself is defined as a P-relative string, as follows:
?SECTION DT^nams
STRING DT^^NAMS = 'P' := [
"fm_header ",
"partner_data ",
.....
"no_data ",
"flow_control "];
LITERAL DT^^WIDTH = 17 ;
The following fragment of code illustrates how your program might extract the
characters, given a data-type value of DT. Note, in particular, how the example tests
the value for legal ranges, treats FM-headers differently, and uses the string-width as
defined by the literal.
IF dt < 0 THEN dt := -1;
IF dt <= dt^^last THEN
BEGIN
index := (dt - dt^^first) * dt^^width;
Desired^Answer ':=' dt^^nams[ index ] FOR dt^^width;
END;