HP Data Entry and Forms Management System (VPLUS) Reference Manual (32209-90024)
Chapter 3 117
INTRODUCTION TO FORMS DESIGN
USING FORMSPEC TO CREATE AN ARB
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 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