Using and Defining ARBs [ HP Data Entry and Forms Management System (VPLUS/V) ] MPE/iX 5.0 Documentation
HP Data Entry and Forms Management System (VPLUS/V)
Using and Defining ARBs
The programmer is responsible for:
* Using the correct data types for each programming language; for
example, REAL is invalid for COBOL applications.
* Aligning and/or padding the ARB/source code. If an odd number of
bytes is followed by an integer, some languages, including Pascal and
FORTRAN, automatically pad the record definition, forcing the integer
to be word-aligned. No such padding occurs in COBOL unless the
SYNCHRONIZED clause is used (see the COBOL II/3000 Reference Manual).
If you use a language whose compiler pads to ensure word alignment for
integers, you must pad your ARB correspondingly. For example, suppose
you are coding in Pascal and you declare a record that looks like this:
ODD_BYTE_EXAMPLE = RECORD
THREE_BYTES : PACKED ARRAY [1..3] OF CHAR;
GOTCHA : INTEGER
.
.
END;
The Pascal compiler will insert an additional byte after THREE_BYTES to
align the integer on a word boundary. You must do the same with the ARB
record; use the ARB LAYOUT screen to add a filler field after the
three-byte field so that the ARB looks like this:
Field Name ARB Type ARB Length
DEPT CHAR 3
FILLER1 CHAR 1
TOTAL PURCHASES DINT 4
* Ensuring the application specifications match the ARB specifications,
for example, if the ARB type is PACK, the COBOL specification should
be COMP-3, not COMP.
* Avoiding run-time errors, which may occur when:
- Converting a CHAR or date source to a numeric destination
- Converting a numeric or CHAR source to a date destination
- Invalid length specifications are encountered
- There are alignment problems; FORMSPEC does not detect these
There is also the possibility that data will be truncated; for
example, if DIG ---> INT, but screenlen is greater than 5.
The ARB Trace Facility
The ARB trace facility may be enabled by setting the JCW VPLUSARBTRACE to
1. This will print trace messages to the stdlist. You may direct
VPLUS/V screens to a different device by using a FILE command to set the
device of the filename used by VOPENTERM to a device other than the
stdlist device.
This is an example of a trace from a form that has seven fields:
:SETJCW VPLUSARBTRACE,1
:FILE VTERM;DEV=99
:RUN ARBPROG
Field #1 : Buffer offset from 0 = 1
Length = 2
Type = INT
Value = 1234
Field #2 : Buffer offset from 0 = 3
Length = 2
Type = INT
Value = 1234
Field #3 : Buffer offset from 0 = 6
Length = 2
Type = INT
Value = 1234
Field #4 : Buffer offset from 0 = 9
Length = 4
Type = DINT
Value = 12345678
Field #5 : Buffer offset from 0 = 14
Length = 4
Type = DINT
Value = -1234567
Field #6 : Buffer offset from 0 = 19
Length = 4
Type = DINT
Value = 12345678
Field #7 : Buffer offset from 0 = 23
Length = 8
Type = CHAR
Value = ABCDEFGH
END OF PROGRAM
:
The trace provides the following information. It shows:
* The location of each field in the ARB (Buffer offset);
* The length of each field in the ARB (Length);
* The type of transformation that occurs (Type);
* The value that is transformed in the ARB field (Value).
NOTE This ARB is tied to seven form fields, but there are gaps in the
buffer before field #1, and between each field from #2 to #6.
These gaps are one-byte filler fields.
MPE/iX 5.0 Documentation