VGETtype [ HP Data Entry and Forms Management System (VPLUS/V) ] MPE/iX 5.0 Documentation
HP Data Entry and Forms Management System (VPLUS/V)
VGETtype
Copies character coded data contents from data buffer into an
application, converting numeric value to specified type.
Syntax
VGETtype {comarea,fieldnum,variable} [{,numdigits,decplaces}]*
Parameters
type The type in VGETtype indicates that this intrinsic may
be specified as:
VGETINT converts value to two-byte integer
VGETDINT converts value to four-byte integer
VGETREAL converts value to four-byte real value
VGETLONG converts value to eight-byte long value
*VGETPACKED converts value to packed decimal format
(COBOL usage is comp-3 format); this
intrinsic has two extra parameters,
numdigits and decplaces. Both are
two-byte integer variables that contain
the number of digits and number of
decimal places, respectively, specified
by the COBOL usage is comp-3 data
declaration.
VGETZONED converts value to zoned decimal format
(COBOL) default format); has the
parameters numdigits and decplaces,
which are two-byte integer variables
that contain the number of digits and
number of decimal places, respectively,
specified by the COBOL data
declaration.
VGETYYMMDD converts date to a six-byte character
value
For example: CALL "VGETINT" USING
COMAREA,FIELDNUM,VARIABLE
CALL "VGETPACKED" USING
COMAREA,FIELDNUM,VARIABLE,NUMDIGITS,DECPLACES
comarea Must be comarea name specified when the forms file was
opened with VOPENFORMF. If not already set, the
following comarea items must be set before calling
VGETtype:
cstatus Set to zero.
comarealen Set to total number of two-byte words
in comarea.
VGETtype may set the following comarea items:
cstatus Set to nonzero value if call
unsuccessful or if requested field has
an error.
fieldnum Two-byte integer variable containing the number assigned
to the field by FORMSPEC.
variable Variable within application, of type specified in
VGETtype, into which converted value is placed.
Discussion
If there is no ARB, all data is read from the unprotected fields on the
screen as character strings and concatenated to create a data buffer.
The VGETBUFFER intrinsic copies the entire buffer to an application
program or VGETFIELD can be used to obtain the contents of an individual
field.
NOTE If you are using VGETBUFFER in conjunction with an ARB, you do not
need to use VGETtype. VGETBUFFER performs all the required
conversions on the screen data in the buffer.
You can use both VGETBUFFER with an ARB and VGETtype calls in the
same program: the buffercontrol setting in the comarea that
controls ARB processing can be switched on or off for each form.
The VGETtype intrinsics, VGETINT, VGETDINT, VGETREAL, VGETLONG,
VGETYYMMDD, VGETPACKED, AND VGETZONED, have been provided to perform
conversion from character coded data to the seven indicated data types.
This intrinsic copies the contents of the field identified by its field
number from the data buffer. (Note that this field number is a unique
number assigned to each field by FORMSPEC and is totally independent of
the field position in the data buffer.) The field's value must be
numeric, but its data type need not be. That is, numbers in a character
type field can be converted.
The numeric value, stored in the buffer in character coded form, is
converted to the specified type and then copied to the variable in the
application. (Refer to Table 6-13 for the format of each type.) If
errors occur during conversion, cstatus is set to an error code. If the
requested field has an error, its value is moved to the variable, but
cstatus is set to an error code.
Table 6-13. Numeric Type Conversion
---------------------------------------------------------------------------------------------
| | |
| Type | Format |
| | |
---------------------------------------------------------------------------------------------
| | |
| INT | Two-byte word fixed-point; twos complement representation of positive |
| | and negative values; range from -32768 through +32767. |
| | |
---------------------------------------------------------------------------------------------
| | |
| DINT | Four-byte word fixed-point format; twos complement representation of |
| | positive and negative range between approximately -2 billion and +2 |
| | billion. (Not used by BASIC programs.) |
| | |
---------------------------------------------------------------------------------------------
| | |
| REAL | Four-byte word floating-point format with sign bit in bit 0; an |
| | exponent (biased by +256) in bits 1 through 9, and a positive |
| | fraction in the remaining 22 bits in HP 3000 format. (Not used by |
| | COBOL programs.) |
| | |
---------------------------------------------------------------------------------------------
| | |
| LONG | Floating -point format using eight-bytes; sign bit in bit 0; an |
| | exponent (biased by +256) in bits 1 through 9, and a positive |
| | fraction in the remaining 54 bits in HP 3000 format. (Not used by |
| | COBOL programs.) |
| | |
---------------------------------------------------------------------------------------------
| | |
| PACKED | COBOL only; comp-3. See COBOL II/3000 Reference Manual. |
| | |
---------------------------------------------------------------------------------------------
| | |
| ZONED | COBOL only. See COBOL II/3000 Reference Manual. |
| | |
---------------------------------------------------------------------------------------------
| | |
| YYMMDD | Six-byte ASCII, in format YYMMDD; for example, 870623. |
| | |
---------------------------------------------------------------------------------------------
The following chart will help you correlate VPLUS/V data types with
VGETtype intrinsics and programming language data types.
Table 6-14. Correlation of VGETtype with the Data Types for Each Language
------------------------------------------------------------------------------------------
| |
| Language Intrinsic Data Type |
| |
------------------------------------------------------------------------------------------
| |
| FORTRAN VGETINT Integer*2 |
| |
| VGETDINT Integer*4 |
| |
| VGETREAL Real |
| |
| VGETLONG Double Precision |
| |
------------------------------------------------------------------------------------------
| |
| BASIC VGETINT Integer |
| |
| VGETREAL Real |
| |
| VGETLONG Long |
| |
------------------------------------------------------------------------------------------
| |
| SPL VGETINT Integer |
| |
| VGETDINT Double |
| |
| VGETREAL Real |
| |
| VGETLONG Long |
| |
------------------------------------------------------------------------------------------
| |
| COBOL VGETINT S9-S9(4)COMP |
| |
| VGETDINT S9(5) - S9(9)COMP |
| |
------------------------------------------------------------------------------------------
| |
| PASCAL VGETINT Subrange -32768..32767 |
| |
| VGETDINT Integer |
| |
| VGETREAL Real |
| |
| VGETLONG Longreal |
| |
------------------------------------------------------------------------------------------
1. If errors occur during conversion, the two-byte status word in the
communications area is set to an error value.
2. If the requested field has been flagged as having an error
(perhaps by VFIELDEDITS or VSETERROR), the conversion is
performed, but the two-byte status word is also set to an error
value.
3. An attempt to convert a number larger than 32767 using VGETINT
returns an error value (504) in the two-byte status word and
leaves the receiving value unchanged.
4. All numeric separators are stripped before conversion is
performed.
5. Fields of type CHAR may be converted as long as they contain
numeric characters (including signs and separators). Otherwise,
an error value is returned in the two-byte status word.
6. VGETINT and VGETDINT only convert the integer portion of a given
field. The fractional portion is truncated before conversion.
Remember that in a field of type IMPn, the rightmost "n"
characters are treated as a fraction.
7. Note that if VGETFIELD is used to pass a field containing a
decimal point to a COBOL program, the decimal point is also passed
and no arithmetic may be performed on the field.
8. Negative numbers can be zoned correctly for COBOL only by using
the VGETINT and VGETDINT intrinsics. VGETBUFFER and VGETFIELD
transfer the negative sign, but COBOL treats the value as
positive, ignoring the sign character. An EXAMINE statement using
TALLY can determine that the negative sign is present and then the
program can treat the value accordingly.
9. Normal rules of truncation in COBOL are followed. For example,
conversion of 12345 using VGETINT with a receiving field of S9(4)
truncates to the value of 2345.
10. VGETINT may be used to convert positive integers to type LOGICAL
in SPL.
Example
COBOL
77 FIELD-NUM PIC S9(4)COMP.
77 COUNT PIC S9(4)COMP.
:
MOVE 5 TO FIELD-NUM
CALL "VGETINT" USING COMAREA, FIELD-NUM, COUNT.
BASIC
210 F1=5
220 CALL VGETINT(Cl(*),F1,C)
FORTRAN
FIELD=5
CALL VGETINT(COMAREA,FIELD,K1)
SPL/PASCAL
INTEGER
FIELD,
COUNT;
:
FIELD:=5;
VGETINT(COMAREA,FIELD,COUNT);
The calls in this example convert a value contained in field 5 in the
data buffer to two-byte integer representation and store it in an
application.
MPE/iX 5.0 Documentation