HPlogo HP Data Entry and Forms Management System (VPLUS) Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 6 USING VPLUS INTRINSICS

INTRINSIC DESCRIPTIONS

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The intrinsics on the following pages are described in alphabetic order for easy reference. However, this is not the order in which they are normally used. Table 6-7 “Intrinsics by Function Group” is provided to group the intrinsics according to the functions they perform. Note that terminal access is performed by only seven intrinsics: VOPENTERM, VCLOSETERM, VPLACECURSOR, VSHOWFORM, VREADFIELDS, VLOADFORMS, and VUNLOADFORM. The remaining intrinsics interact with the form definition, data buffer, window, and key label areas of memory. An example of the order in which the intrinsics are used is shown in Table 6-7 “Intrinsics by Function Group”

Table 6-7 Intrinsics by Function Group

Function

Intrinsic

Access to Terminal

VOPENTERM VCLOSETERM VSHOWFORM VPLACECURSOR

VREADFIELDS VLOADFORMS VUNLOADFORM

Access to Forms Definition

VOPENFORMF VGETFIELDINFO VGETFORMINFO VPRINTFORM

VCLOSEFORMF VGETFILEINFO VGETNEXTFORM VCHANGEFIELD

Data Processing

VINITFORM VFINISHFORM

VFIELDEDIT

Data Entry

VCLOSEBATCH VPOSTBATCH VWRITEBATCH

VOPENBATCH VREADBATCH

Programmatic Access to Data

VGETBUFFER VPUTBUFFER
VGETtype

VGETFIELD VPUTFIELD VPUTtype

Access to Error/Status Window, Function Key Labels, Native Language ID

VERRMSG VGETKEYLABELS VSETKEYLABELS VGETLANG

VSETERROR VPUTWINDOW VSETKEYLABEL VSETLANG

 

All intrinsics require that three items in comarea (cstatus, language and comarealen) are set before the intrinsic is called. However, two of these items, language and comarealen, only need to be initially set, prior to the first intrinsic call, since they are not modified by any subsequent intrinsics. In contrast, cstatus should be reset before calling any intrinsic after an error occurs (except for the intrinsic VERRMSG that uses cstatus in retrieving the associated error message).

No running examples are provided with the intrinsic descriptions. Instead, Appendix A contains sample programs that use many of the intrinsics described in this section.

Figure 6-2 Intrinsic Flow

Intrinsic Flow

Figure 6-2 Intrinsic Flow Continued:

Dependency Between Intrinsics

Certain intrinsics must be called before other intrinsics can be executed. Figure 6-3 “Intrinsics Dependencies” illustrates the standard dependencies among intrinsics. For example, the terminal file must be opened before any other intrinsics are called if prompts are to be sent to the terminal. Each of the three files, terminal, forms and batch must be opened before operations can be performed on these files and before the files can be closed.

Figure 6-3 Intrinsics Dependencies

Intrinsics Dependencies

VARMSCP

Arms or disarms cursor sensing capability.

Syntax

VARMSCP {comarea,scpenable}

Parameters

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 VARMSCP:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words comarea. Must be at least 70 words in length.

VARMSCP

May set the following comarea item, cstatus.

cstatus

Set to nonzero value if call is unsuccessful.

scpenable

Two-byte logical variable which determines whether the cursor position sensing is enabled or not.

  • 0 - Disarm cursor sensing.

  • 1 - Arm cursor sensing.

Discussion

When cursor sensing is armed, the data returned after a read, as in VREADFIELDS, is prefixed with an escape sequence which contains the position of the cursor on the screen when the read terminated. This information is used by VGETSCPFIELD and VGETSCPDATA to retrieve the cursor position.When cursor sensing is disarmed, no cursor position information is available following a read. VREADFIELDS automatically disarms cursor sensing. VARMSCP should be called prior to a cursor sensing transaction to arm the cursor sensing function for the next read. This deletes any existing cursor location information.

Example

COBOL
CALL "VARMSCP" USING COMAREA SCP-ENABLE.SPL
VARMSCP(COMAREA,SCP'ENABLE);

These calls arm/disarm cursor sensing depending on whether the second parameter contains a 1 or a 0 respectively.

VBLOCKREAD

The VBLOCKREAD intrinsic reads a block of characters from a terminal in block mode. The syntax and parameter descriptions for this intrinsic are provided below.

VBLOCKREAD {COMAREA,BUF,LEN,ACTLEN,TMODE,LOC,BC,TC}
COMAREA

The following COMAREA fields must be set before calling VBLOCKREAD, if not already set:

LANGUAGE

Set to code identifying the programming language of the calling program.

COMAREALEN

Set to total number of 2-byte words in COMAREA.

VBLOCKREAD may set the following COMAREA fields:

CSTATUS

Set to nonzero value if call is unsuccessful.

FILERRNUM

Set to file error code if MPE file error.

BUF

Byte array to receive data from the terminal.

LEN

Maximum number of bytes to read from terminal (2-byte integer).

ACTLEN

Actual number of bytes read from terminal (2-byte integer).

TMODE

Terminal setting at the time of read (2-byte integer).

1

assume terminal is in format mode.

2

assume terminal is in unformatted mode.

LOC

Start position of write (array of two 2-byte integers). Absolute cursor addressing is not allowed in format mode. An error will be returned.

[0] [0]

home cursor before read

[-1] [0]

start from current cursor position

BC

Buffer control (2-byte integer) -- not currently used. Must initialize to zero.

TC

Terminal control (2-byte integer)--not currently used. Must initialize to zero.

This intrinsic reads a block of data from the terminal with a number of options. There are two major differences between VREADFIELDS and this procedure. First, it provides more options for reading data from the terminal. Second, data read is returned directly to the application buffer. There is no VPLUS form associated with the read.

Like the companion intrinsic, VBLOCKWRITE, this procedure is recommended only for advanced programmers who are proficient with terminal input/output. VOPENTERM must be called before using VBLOCKREAD. The keyboard must be unlocked before calling VBLOCKREAD. (Refer to keyboard unlock options in VBLOCKWRITE.) VBLOCKREAD will lock the keyboard immediately after Enter or a function key is pressed to ensure data integrity.

This procedure is primarily designed for unformatted reads. For users who do not use VREADFIELDS but use VBLOCKREAD to read data in format mode, the application data interpretation algorithm should accommodate both MDT (Modified Data Tag) and non-MDT inputs. When MDT is on, unmodified blanks and data are not transmitted from the terminal. Refer to the appropriate terminal reference manuals for further explanation of the MDT feature.

The following examples illustrate a call to VBLOCKREAD using common programming languages:

COBOL:

   CALL "VBLOCKREAD" USING COMAREA @ BUF LEN ACTLEN TMODE LOC BC TC. 

BASIC:

   CALL VBLOCKREAD(C(*),B1$,L1,L2,M1,L(*),U1,U2)

FORTRAN:

   CALL VBLOCKREAD(COMAREA,BUF,LEN,ACTLEN,TMODE,LOC,BC,TC)

SPL:

   VBLOCKREAD(COMAREA,BUF,LEN,ACTLEN,TMODE,LOC,BC,TC);

Pascal:

   VBLOCKREAD(COMAREA,BUF,LEN,ACTLEN,TMODE,LOC,BC,TC);

VBLOCKWRITE

The VBLOCKWRITE intrinsic writes a block of characters to a terminal in block mode. The syntax and parameter descriptions for this intrinsic are provided below.

   VBLOCKWRITE {COMAREA,BUF,LEN,TMODE,LOC,TC}
COMAREA

The following COMAREA fields must be set before calling VBLOCKWRITE, if not already set:

LANGUAGE

Set to code identifying the programming language of the calling program.

COMAREALEN

Set to total number of 2-byte words in COMAREA.

VBLOCKWRITE may set the following COMAREA fields:

CSTATUS

Set to nonzero value if call is unsuccessful.

FILERRNUM

Set to file error code if MPE file error.

BUF

Byte array containing characters to be written to the terminal.

LEN

Number of bytes in the BUF array (2-byte integer).

TMODE

Terminal mode (2-byte integer).

0

do not change terminal mode.

1

change to format mode.

2

change to unformatted mode.

LOC

Start position of write (array of two 2-byte integers). Absolute cursor addressing is not allowed in format mode. An error will be returned.

[0] [0]

home cursor before WRITE

[x] [y]

start from absolute row x, column y. (Not allowed in format mode.)

[-1] [0]

start from current position

[-2] [0]

start from first available line of display memory, for example, the first available line after the end of a previous form. (Not allowed in format mode.)

TC

Terminal control (2-byte integer)

0

do not lock keyboard at the beginning of write; unlock at the end of write.

1

lock keyboard at the beginning of write; unlock at the end of write.

This procedure writes the content of a user buffer to a terminal. TMODE options can be used to change the terminal to format or unformatted mode before the write. LOC options allow the programmer to specify the position of the screen where the write is to begin. Terminal control (TC) options can be used to control keyboard locking for the protection of data as it is being written to the terminal. TC = 1 is recommended for applications which do multiple writes to the terminal with no intervening reads. Procedures, such as VBLOCKREAD or VREADFIELDS, lock the keyboard as soon as the terminal begins transmitting data when triggered by the Enter key or a function key.

VOPENTERM must be called before using this procedure. This procedure is intended only for advanced programmers who are proficient with terminal control operations and VPLUS terminal settings. Terminal keyboard operations, such as PREV PAGE and NEXT PAGE, can be performed programmatically by sending the appropriate escape sequences to the terminal via VBLOCKWRITE. VBLOCKWRITE can also be used to write large blocks of unformatted text or multiple report lines in between uses of predefined VPLUS forms. To ensure portability of the application from one driver to another, alteration of terminal straps using VBLOCKWRITE is not recommended. See VTURNON and VTURNOFF for information on how to switch between character mode and block mode without disturbing the screen.The following examples illustrate a call to VBLOCKWRITE using common programming languages:

COBOL:

   CALL "VBLOCKWRITE" USING COMAREA @BUF LEN TMODE LOC TC. 

BASIC:

   CALL VBLOCKWRITE(C(*),B1$,L1,M1,L(*),T1) 

FORTRAN:

   CALL VBLOCKWRITE(COMAREA,BUF,LEN,TMODE,LOC,TC) 

SPL:

   VBLOCKWRITE(COMAREA,BUF,LEN,TMODE,LOC,TC); 

Pascal:

   VBLOCKWRITE(COMAREA,BUF,LEN,TMODE,LOC,TC); 

VCHANGEFIELD

Allows dynamic field attribute definition.

Syntax

 VCHANGEFIELD {comarea,specbuffer,numentries}

Parameters

comarea

Must be comarea specified when forms file was opened with VOPENFORMF. If not already set, the following comarea items must be set before calling VCHANGEFIELD:

cstatus

Set to zero.

language

Set to code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VCHANGEFIELD may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

specbuffer

A record; the specifications buffer is an array that provides VCHANGEFIELD with the information regarding the fields which are to be altered. The format of the array is as shown in Table 6-8 “Specifications Buffer”

numentries

A two-byte integer indicating the number of entries in the specifications buffer. The specifications buffer can contain up to three types of changes for each field in the form. That is, one call to VCHANGEFIELD can change the field type, data type and enhancement of every field in a form. For example, if a form contains four fields and an application is designed to make three changes to each field, then numentries should have a value of 12.

Discussion

VCHANGEFIELD alters the run-time copy of the current form. It does not modify the contents of the forms file. The next call to VGETNEXTFORM which actually retrieves a copy of the form from the forms file will reset the field specifications. The only exception to this is when two calls to VGETNEXTFORM are performed without resetting nfname; the second call will not retrieve the form definition from the forms file.

Please note that it is the responsibility of the programmer to ensure that a new data type is compatible with any initial values or processing specifications which may have been defined for the field.

If the change type selected is a toggle type, (change type of 1, 2 or 3), the change specification buffer is returned with the "old" characteristics. Hence, the next VCHANGEFIELD call with the same buffer will toggle between the characteristics specified in the first VCHANGEFIELD call and the original characteristics. To toggle between two specific characteristics, VCHANGEFIELD can be used to set a field (change type of 4, 5, or 6) to certain starting characteristics without the toggle option at first.

Table 6-8 Specifications Buffer

Data Type

Position

Description

Integer (Two-byte)

1

positive field number or negative screen order number

Integer (Two-byte)

2

Change type
1 = toggle enhancement
2 = toggle field type
3 = toggle data type
4 = change enhancement
5 = change field type
6 = change data type

Character array (4-byte)

3-4

Change Specifications
Type 1, 4 values = H, I, B, U, NONE
Type 2, 5 values = 0, D, P, R
Type 3, 6 values = CHAR, DIG, IMPn, NUM [n], DMY, MDY, YMD

 

VCHANGEFIELD has no effect on the security or color enhancements; an error is returned if the codes for these enhancements (1-8 or S) are specified. VCHANGEFIELD does not alter the field error enhancement nor is this enhancement code returned when the enhancement attribute is toggled (rather the current "normal" enhancement is altered and returned if toggling).

Example

COBOL

CALL "VCHANGEFIELD" USING COMAREA,SPECBUF,ENTRIES.

BASIC

CALL VCHANGEFIELD(C(*),Bl,EN)

FORTRAN

CALL VCHANGEFIELD(COMAREA,SPECBUF,ENTRIES);

SPL/PASCAL

 VCHANGEFIELD(COMAREA,SPECBUF,ENTRIES);

VCLOSEBATCH

Closes an open batch file.

Syntax

VCLOSEBATCH" {comarea}

Parameters

comarea

Must be name of comarea specified in VOPENBATCH call that opened this batch file. If not already set, the following comarea items must be set before calling VCLOSEBATCH:

cstatus

Set to zero.

comarealen

Set to total number of two -byte words in comarea.

VCLOSEBATCH may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

Discussion

The open batch file identified by comarea is closed when this intrinsic is called. The batch file must be closed before VCLOSEFORMF is called.

Example

COBOL

CALL "VCLOSEBATCH" USING COMAREA.

BASIC

200 CALL VCLOSEBATCH(C(*))

FORTRAN

CALL VCLOSEBATCH(COMAREA)

SPL/PASCAL

VCLOSEBATCH(COMAREA);

VCLOSEFORMF

Closes an open forms file.

Syntax

VCLOSEFORMF {comarea}

Parameters

comarea

Must be comarea specified when forms file was opened with VOPENFORMF. If not already set, the following comarea items must be set before calling VCLOSEFORMF:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VCLOSEFORMF may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

Discussion

The open forms file is closed when this intrinsic is executed. Once closed, the forms file is not available for further processing.

Example

COBOL

CALL "VCLOSEFORMF" USING COMAREA.

BASIC

200 CALL VCLOSEFORMF(C(*))

FORTRAN

CALL VCLOSEFORMF(COMAREA)

SPL/PASCAL

VCLOSEFORMF(COMAREA);

VCLOSETERM

Closes an open terminal file.

Syntax

VCLOSETERM {comarea}

Parameters

comarea

Must be comarea named when file was opened by VOPENTERM. If not already set, the following comarea items must be set before calling VCLOSETERM:

cstatus

Set to zero.

comareaten

Set to total number of two-byte words in comarea.

VCLOSETERM may set the following comarea items:

ctstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

Discussion

The terminal file opened with the specified comarea is closed when this intrinsic is executed. For terminals with this feature, the local forms storage of the terminal is cleared. For additional information about about using the pseudo intrinsic .LOC to put and address into a word of the COMAREA, refer to the COBOL II/XL Reference Manual.

Example

COBOL

CALL "VCLOSETERM" USING COMAREA.

BASIC

200 CALL VCLOSETERM(C(*))

FORTRAN

CALL VCLOSETERM(COMAREA)

SPL/PASCAL

VCLOSETERM(COMAREA);

VERRMSG

Returns a message corresponding to the error number of an edit error or an intrinsic call error.

Syntax

VERRMSG {comarea,buffer,buflen,actualen}

Parameters

comarea

Must be comarea named when forms file was opened with VOPENFORMF. If not already set, the following comarea items must be set before calling VERRMSG:

language

Set to code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

errfilenum

Contains MPE file number of VPLUS error message file; should be initialized to zero so that VERRMSG can open the error message file.

(Note that cstatus must not be cleared before calling this intrinsic.)

VERRMSG may set the following comarea items:

errfilenum

If initialized to zero, VERRMSG opens VPLUS error message file and sets errfilenum to MPE file number of the opened file.

buffer

Character string in an application to which message is returned by VERRMSG. In order to contain the message, this buffer must be defined as at least 72 bytes long.

buflen

Two-byte integer variable set by an application to the length of the buffer.

actualen

Two-byte integer to which VERRMSG returns the number of bytes in the message sent to buffer.

Discussion

If an error occurs in an intrinsic call or is detected by a VPLUS edit, a call to VERRMSG returns the message associated with the error. For an intrinsic call error, cstatus is set to a nonzero value. If cstatus indicates an error, VERRMSG returns the text explaining the type and cause of the error. If VINITFORM, VFIELDEDITS, or VFINISHFORM detects a data error, cstatus is set to zero and numerrs is set to a nonzero value. If numerrs is set, VERRMSG returns a custom error message if there is one; otherwise, it returns the VPLUS error message associated with the edit error number in the VPLUS error message file. The error message, custom or VPLUS, is returned for the first field flagged in error.

The message describing the error is returned to an application in the area defined by the buffer parameter. The message length can be no longer than buflen; the actual length of the message is returned in actualen. You can then call VPUTWINDOW to move this message to the window area of memory for later display at the terminal.

The errfilenum contains the MPE file number of the VPLUS error message file. This file contains the error numbers and their associated messages for both intrinsic call and edit errors. It does not contain custom error messages, which are retrieved by VERRMSG through the form definition. VERRMSG opens this file if errfilenum equals zero when VERRMSG is called; it then sets errfilenum to the MPE file number of the file. The file is closed automatically when an application terminates.

If the VPLUS error message file cannot be opened and read by this intrinsic, default messages are generated. If cstatus is not equal to zero, the message is:

"VPLUS Error, COM'STATUS is nnn".

If cstatus is zero and numerrs is greater than zero, the message is:

"VPLUS Edit Error nnn".

Example

COBOL

CALL "VERRMSG" USING COMAREA, BUFFER, BUFLEN, ACTUALEN.

BASIC

225 CALL VERRMSG(C(*),M$,L,M)

FORTRAN

CALL VERRMSG(COMAREA,BUFFER,BUFLEN,ACTUALEN)

SPL/PASCAL

VERRMSG(COMAREA,BUFFER,BUFLEN,ACTUALEN);

Assume that filerrnum contains an MPE file error code. The calls to VERRMSG shown above return to your application a message describing the error and the length of this message in bytes.

VFIELDEDITS

Edits data entered in each field of form and, if indicated, modifies data in the data buffer. If necessary, sets error flags.

Syntax

VFIELDEDITS {comarea}

Parameters

comarea

Must be comarea name specified when forms file was opened with VOPENFORMF. If not set already, the following comarea items must be set before calling VFIELDEDITS:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VFIELDEDITS may set the following comarea items:

numerrs

Set to total number of fields in which errors were detected.

cstatus

Set to nonzero value if call unsuccessful.

nfname

Set to new next form name if name changed by processing specifications.

repeatapp

Set to new current form code if code changed by processing specifications.

freezapp

Set to new next form code if code changed by processing specifications.

Discussion

This intrinsic checks the data content of each field. It checks that the data type and field type are correct, and if any special processing specifications were defined for this field in the Field Edit phase, it checks that the data conforms to these specifications. If any data formatting or data movement was specified for a field, VFIELDEDITS performs these functions on the data in the data buffer.

For each field that does not pass the edit checks, VFIELDEDITS sets an error flag. These error flags are used by the VPLUS intrinsics, as shown in Table 6-9 “Actions Used by Intrinsics” In addition, these error flags can be accessed by an application with a call to VGETFORMINFO, which retrieves a table corresponding to the current error flag settings.

Table 6-9 Actions Used by Intrinsics

Intrinsic

Action

VGETNEXTFORM

Initializes all the error flags to zero.

VFIELDEDITS VFINISHFORM VINITFORM VSETERROR

Each may set field error flags on, increment numerrs, and set an internal error number used by VERRMSG.

VSHOWFORM

Enhances the fields whose error flags are set.

VREADFIELDS

Resets the flags to zero after the form is displayed.

VPUTBUFFER VPUTFIELD VPUTtype

Each may clear field error flags and decrement numerrs if new data is entered into a field with an error.

 

After setting error flags for all fields with errors, VFIELDEDITS saves the error number of the first field with an error. (Fields are counted in screen order, starting at the top left and moving left to right, then top to bottom.) VFIELDEDITS sets numerrs to the total number of fields in which errors were found.

If requested by a call to VERRMSG, the text associated with the error number in the VPLUS error message file, or the associated custom error message, is returned to an application. If requested by a call to VPUTWINDOW, the message is copied to the window area of memory. Then, a call to VSHOWFORM can be used to display this message on the terminal screen and enhance the fields with errors.

Example

COBOL

CALL "VFIELDEDITS" USING COMAREA.

BASIC

150 CALL VFIELDEDITS(C(*))

FORTRAN

CALL VFIELDEDITS(COMAREA)

SPL/PASCAL

VFIELDEDITS(COMAREA);

VFINISHFORM

Performs any processing specifications defined for the final phase of fields editing.

Syntax

VFINISHFORM {comarea}

Parameters

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 VFINISHFORM:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VFINISHFORM may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

numerrs

Set to total number of fields in the form in which errors were detected.

nfname

Set to name of next form if processing specifications altered form name.

repeatapp

Set to new repeat code if processing specifications altered code.

freezapp

Set to new next form code if processing specifications altered code.

Discussion

All special processing defined as part of the "finish" phase of field editing is performed by this intrinsic. Altering the next form to be displayed is a typical finish operation, and updating a save field is another. (Refer to the discussion of phases in Section 4.) Like VFIELDEDITS, VFINISHFORM sets an error flag for each field that has an error as a result of processing the form. (Refer to the VFIELDEDITS discussion.)

Example

COBOL

CALL "VFINISHFORM" USING COMAREA.

BASIC

160 CALL VFINISHFORM(C(*))

FORTRAN

CALL VFINISHFORM(COMAREA)

SPL/PASCAL

VFINISHFORM(COMAREA);

The examples above perform all finish operations on a form.

VGETARBINFO

A new VPLUS intrinsic has been added to retrieve the VPLUS ARB field mapping information. The intrinsic is named VGETARBINFO and is callable as follows:

      CALL "VGETARBINFO" USING VPLUS-COMAREA,
ARB-INFO-BUF,
INFO-BUF-LEN.
      Record VPPLUS-COMAREA << use existing definitions >>
      Record ARB-INFO-BUF: 
      Record ARB-INFO-HEADER:
        2 byte integer NUM-OF-ENTRIES;     << input only >> 
2 byte integer ENTRY-LEN; << input only >>
6 byte array FORM-NAME; << input only >>
16 byte array FILLER; << reserved for future use >>
2 byte integer NUM-ARB-FLDS. << output only >>
      Table of record ARB-INFO-DETAIL:
        2 byte integer FIELD-NUM;          << input only >> 
10 byte array ARB-DATA-TYPE; << output only >>
2 byte integer ARB-DATA-LEN; << output only >>
2 byte integer ARB-BUF-OFFSET. << output only >>
    2 byte integer INFO-BUF-LEN.      << total 2 byte word length of >> 
<< ARB-INFO-BUF, minimum valid >>
<< length is 27. >>;
NUM-OF-ENTRIES

indicates number of ARB-INFO-DETAIL table entries and must be zero or greater; if number of entries is zero then the intrinsic returns immediately to the application (in other words, does a no-op).

ENTRY-LEN

indicates number of ARB-INFO-DETAIL table entries and must be zero or greater; if number of entries is zero then the intrinsic returns immediately to the application (in other words, does a no-op).

FORM-NAME

contains justified, upshifted form name of 1 to 15 characters, blank terminated.

FILLER

reserved for future use; should be initialized to 16 blanks.

NUM-ARB-FLDS

at output indicates the number of ARB fields defined for the specified form. Values for NUM-ARB-FLDS range from zero (no active ARB fields in specified form ARB; all are filler), to 128 (maximum number of fields in any one form).

NOTE: If this intrinsic is called for a form with zero active fields in the form's ARB, the intrinsic continues to process all ARB-INFO-DETAIL entries, returning $NOTARBFLD for each entry.)
FIELD-NUM

is ARB-INFO-DETAIL table key and contains field number assigned by FORMSPEC.

ARB-DATA-TYPE

at output contains field type conversion notation from FORMSPEC, for example, CHAR, DINT, SPACK2, or token $NOTARBFLD, which indicates that the requested field does not exist within the ARB.

ARB-DATA-LEN

at output contains ARB field length in bytes (not updated if field does not exist in ARB).

ARB-BUF-OFFSET

at output contains zero relative byte offset of the ARB field (not updated if field does not exist in ARB).

VGETBUFFER

Copies entire contents of data buffer from memory to an application.

Syntax

VGETBUFFER  {comarea,buffer,buflen}

Parameters

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 VGETBUFFER:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea. Must be at least 70 words in length if the ARB feature is used.

buffercontrol

Set bit 15 to 1 to indicate that data is to be transformed according to the ARB specifications.

VGETBUFFER may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

bufferstatus

Bit 15 set to 1 if data conversion successful.

buffer

Character string in an application to which the data in the data buffer is copied. Could also be a record describing the ARB, i.e., non-CHAR data.

buflen

Two-byte integer variable that specifies the number of bytes to be transferred to the user buffer.

Discussion

This intrinsic transfers data from the data buffer in memory to the area in an application specified by the buffer parameter. The data includes everything in the unprotected and display-only fields on a form. Previously, data in the data buffer was stored in the order of the fields on the form, and specific fields could be moved from the buffer with VGETFIELD or VGETtype. Now, the Application-ready Buffer (ARB) allows you to specify, using the FORMSPEC ARB feature, the order in which the application should receive the fields in the buffer, and the data type conversion to be performed on each (see the discussion on creating an ARB in Section 3). You need no longer use VGETtype to convert individual fields; a call to VGETBUFFER accomplishes the task.

The number of bytes moved from the data buffer is based on the number of bytes specified in the buflen parameter, or the number of bytes specified by the dbuflen item in the comarea (refer to Table 6-5), whichever is less. The dbuflen item is set by VGETNEXTFORM when the current form is read into memory. For example, if there are 20 bytes in the data buffer (dbuflen is 20), and the user requests 50 bytes in the buflen parameter, only 20 bytes are transferred. Conversely, if the user requests 10 bytes through the buflen parameter, but there are 20 bytes in the data buffer (dbuflen is 20), only 10 bytes are transferred.

Special Considerations

Designers using the ARB feature in VGETBUFFER should be aware that damaging run-time errors could occur if the application is inadvertently run on a system that has a VPLUS version earlier than B.05.00.

To prevent this, the designer should do three things:

  1. Document the product with a clear warning that VPLUS version B.05.00 or later MUST be used.

  2. Use the VPLUS intrinsic HP32209 in the code. This intrinsic checks to make sure that you are using the proper VPLUS version. If not, the application should terminate with an appropriate message.

  3. Check offset 65 (bufferstatus) in the comarea on return from VGETBUFFER. Bit 15 will be set to 1 if VGETBUFFER performed the conversion successfully. In other words, the application must check both status and bufferstatus to be sure that the data was correctly converted.

Example

COBOL

01 ORDER-ENTRY.
03 PART-NO PIC X(7).
03 DESCR PIC X(12).
03 QTY PIC S9(4).
03 UNIT-PR PIC S9(4)V9(2).
03 TOTL-PR PIC S9(6)V9(2).
:
:
CALL "VGETBUFFER" USING COMAREA, ORDER-ENTRY, DBUFLEN.

BASIC

340 L1=D1           <D1 is the dbuflen word in C
350 CALL VGETBUFFER(C(*),D$,L1)

FORTRAN

CALL VGETBUFFER(COMAREA,D1,DBFLEN)

SPL/PASCAL

BYTE ARRAY D1 (0:36) ;
:
:
VGETBUFFER(COMAREA,D1,DBUFLEN);

The examples above transfer the contents of the data buffer in memory to an application. The current value of dbuflen is specified as the user buffer length.

VGETFIELD

Copies contents of specified field from data buffer in memory to an application.

Syntax

         VGETFIELD {comarea,fieldnum,fieldbuf,buflen,actualen,nextfldnum}

Parameters

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 VGETFIELD:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VGETFIELD may set the following comarea items:

cstatus

Set to nonzero if call unsuccessful, or if requested field has an error, or if fieldnum is unacceptable.

fieldnum

Two-byte integer variable containing the number assigned to the field by FORMSPEC.

fieldbuf

Character string in an application to which data entered in specified field is copied.

buflen

Two-byte integer variable that specifies the number of bytes in fieldbuf.

actualen

Two-byte integer to which VGETFIELD returns the number of bytes actually moved to fieldbuf.

nextfldnum

Two-byte integer to which VGETFIELD returns the number of the next field in screen order. If there are no more fields, zero is returned. If fieldnum was set to zero or a negative number by an application, this is an error. In this case, VGETFIELD returns the number of the first field in screen order in nextfieldnum.

Discussion

VGETFIELD transfers the contents of the field specified by fieldnum from the data buffer to a variable in an application. This is in contrast to VGETBUFFER which retrieves data according to the current field layout.

When considering what is transferred by VGETFIELD, keep in mind that all the fields defined for a particular form in FORMSPEC are assigned numbers. The number assigned to a field by FORMSPEC does not change regardless of any changes to the field's position in the form or to its length and does not necessarily correspond to the screen order. The field numbers on a form can only be changed with the batch command, RENUMBER, as described in Section 7. The field number must not be confused with the field's position in the data buffer, which corresponds to its position in the form according to screen order, not assigned field number.

If the number of bytes specified by buflen is less than the field size, the rightmost bytes are truncated. If the requested field has an error, its value is returned, but cstatus is set to an error number indicating the field error flag is set.

Following a successful transfer, actualen contains the exact number of bytes transferred to fieldbuf, the user buffer; nextfldnum is set to the number of the next field in screen order, or to zero after the last field is processed.

Note that VGETFIELD does not convert the data it moves. If you want to convert the field, you must use VGETtype, where type specifies the data type to which the field is converted.

Example

COBOL

DATA DIVISION.
77 ORD-LEN PIC S9(4)COMP.
77 ITEM-LEN PIC S9(4)COMP.
77 FIELD-NUM PIC S9(4)COMP.
77 ACTUAL-LENGTH PIC S9(4)COMP.
77 NEXT-FIELD PIC S9(4)COMP.
01 ORDER-ENTRY.
03 PART-NO PIC X(8).
03 UNIT-PR PI C 9 (4) V9 (2).
03 QUANTITY PIC S9(4)COMP.
03 TOTAL-PR PIC 9(5)V9(2).
03 PART-DESCR PIC X(12). <- field number "2"
:
:
PROCEDURE DIVISION.
:
:
MOVE 12 TO ITEM-LEN.
MOVE 2 TO FIELD-NUM.
CALL "VGETFIELD" USING COMAREA, FIELD-NUM, PART-DESCR OF ORDER-ENTR,
ITEM-LEN, ACTUAL-LENGTH, NEXT-FIEL.

BASIC

350 F1=2
355 L1=12
360 CALL VGETFIELD(C(*),F1,P$,L1,A1,N1)

FORTRAN

FIELD=2
LEN=12
CALL VGETFIELD(COMAREA,FIELD,PARTDES,LEN,LENFLD,NXTFLD)

SPL/PASCAL

INTEGER
FIELD,
LEN;
BYTE ARRAY PARTDES(0:11);
:
:
FIELD:=2;
LEN:=12;
VGETFIELD(COMAREA,FIELD,PARTDES,LEN,ACTUAL'LEN,NEXT'FLD);

Assume that the contents of field number "2" is to be copied, and that the length of this field is 12 bytes. The calls shown above copy the contents of this field into a variable in an application.

VGETFIELDINFO

Returns information about specified fields to an application.

Syntax

VGETFIELDINFO {comarea,infobuf,infobuflen}

Parameters

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 VGETFIELDINFO:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VGETFIELDINFO may set the following comarea item:

cstatus

Set to nonzero value if call unsuccessful.

infobuf

A record through which you pass the request for field information and to which the intrinsic returns the specified information. This parameter must be initialized to spaces before filling in your request and calling VGETFIELDINFO. The layout of infobuf is shown in Table 6-10 “Field Information Buffer”. The three required fields of infobuf pass user-supplied parameters to VGETFIELDINFO as follows:

numofentries

Specifies how many fields you want information about.

entrylength

Indicates how many two-byte words of information (maximum 17 as shown in Table 6-10 “Field Information Buffer”) you want about each field.

formname

The name of the form that contains the fields you are inquiring about.

The rest of infobuf (beginning with position 11) must consist of entrylength number of words for each field you want information about. Thus, the total length of infobufin words must be as follows:

                              10 + (entrylength * numofentries)

You may pass one or more of the three permissible keys, which must be passed in the position indicated in the table. Remember that infobuf must be initialized to spaces before filling in the parameters and any key.

infobuflen

Two-byte integer variable set to the number of two-byte words in infobuf.

Discussion

This intrinsic accesses an internal table and places information about one or more fields into infobuf. You tell VGETFIELDINFO how many fields, how much information about each field, and the name of the form containing the fields.

Table 6-10 Field Information Buffer

Data Type

Position

Contents

Comments

Integer (Two-byte)

1

numofentries

Required

2

entrylength

Required

Character Array (16-byte)

3-10

formname

Required; second byte of position 10 is unused

11-18

Field name

Permissible key; last byte of position 18 is unused

Integer (Two-byte)

19

Field number according to screen order

Permissible key

20

Field number

Permissible key; in order of creation

21

Field length

In bytes

22

Position of field in data buffer

In bytes, offset from zero

Character Array (4-byte)

23-24

Field enhancement

Combination of I, H, U, B, 1-8, or NONE.

25-26

Data type of field

May be CHAR, DIG, IMPn, date (MDY, DMY, YMD), or NUM[n].

Character (Two-byte)

27

Field type

First byte of position 27; may be O, R, P or D.

 

Passing INFOBUF Without Entering Keys

Keys are optional. If you do not supply a key to indicate the first field you want information about, VGETFIELDINFO starts with the first field not already reported on by the current call.

As an example, suppose you want information about 10 fields, and you enter screen order numbers 3, 5, and 6 as keys. VGETFIELDINFO returns information about fields 3, 5, 6, and 7 through 13. If you enter no keys, VGETFIELDINFO returns information about fields 1 through 10.

Table Wraparound

VGETFIELDINFO starts over with the first field in the form if you request information about more fields than are in the form or, if when you pass a key, your request goes beyond the end of the form.

Suppose a form has 12 fields. If you request information about 10 of the fields and enter screen order number 8 as a key, VGETFIELDINFO returns information about fields 8 through 12, and then goes to the beginning of the form and returns information about fields 1 through 5.

Example

COBOL

DATA DIVISION.
:
:
WORKING-STORAGE SECTION.
01 INFOBUF.
05 NUMBER-OF-ENTRIES PIC S9(4) COMP.
05 ENTRY-LENGTH PIC S9(4) COMP.
05 FORM-NAME PIC X(15).
05 FILLER PIC X.
05 ENTRY-TABLE OCCURS 10 TIMES.
10 FIELD-NAME PIC X(15).
10 FILLER PIC X.
10 SCREEN-ORD-NUM PIC S9(4) COMP.
10 FIELD-NUM PIC S9(4) COMP.
10 FIELD-LENGTH PIC S9(4) COMP.
10 FIELD-POSITION PIC S9(4) COMP.
10 FIELD-ENHANCE PIC X(4).
01 INFOBUFLEN PIC S9(4) COMP VALUE 80.
:
:
PROCEDURE DIVISION.
:
:
MOVE SPACES TO INFOBUF.
:
MOVE 5 TO NUMBER-OF-ENTRIES.
MOVE 14 TO ENTRY-LENGTH.
MOVE "FORM1 " TO FORM-NAME.
MOVE 2 TO SCREEN-ORD-NUM.
CALL "VGETFIELDINFO" USING COMAREA, INFOBUF, INFOBUFLEN.

The example shown above illustrates the data declaration of infobuf and infobuflen and the passing of parameters to VGETFIELDINFO. Note that before the intrinsic is called, infobuf is initialized to spaces (not zeros). The intrinsic copies 14 two-byte words of information about fields 2 through 6 of form FORM 1 into infobuf.

VGETFILEINFO

Returns information about forms file to an application.

Syntax

VGETFILEINFO {comarea,infobuf,infobuflen}

Parameters

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 VGETFILEINFO:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VGETFILEINFO may set the following comarea item:

cstatus

Set to nonzero value if call unsuccessful.

infobuf

A record through which you pass the request for forms file information and to which the intrinsic returns the specified information. This parameter must be initialized to spaces before filling in your request and calling VGETFILEINFO. The layout of infobuf is shown in Table 6-11 “File Information Buffer” The two required fields of infobuf pass user-supplied parameters to VGETFILEINFO as follows:

numofentries

Specifies how many times you want the information repeated (information is returned only about the forms file associated with comarea; if you specify a number greater than one, you get duplicate information).

entrylength

Indicates how many two-byte words of information (maximum 19 as shown in Table 6-11 “File Information Buffer”) you want about the file.

Remember that infobuf must be initialized to spaces before filling in the parameters.

infobuflen

Two-byte integer variable set to number of two-byte words in infobuf.

Discussion

This intrinsic accesses an internal table and places information about the open forms file into infobuf. You tell VGETFILEINFO how much information you want about the file.

Table 6-11 File Information Buffer

Data Type

Position

Contents

Comments

Integer (Two-byte)

1

numofentries

Required

2

entrylength

Required

Integer Array (Four-byte)

3-4

File version number

A date/time stamp, recorded at last forms file compile.

Integer (Two-byte)

5

Number of forms in file

 

6

Maximum number of fields

In any one form

7

Maximum data buffer size in two-byte words

Of any one form, plus up to one additional two-byte word.

8

Number of save fields in file

 

Character Array

9-16

Name of head form in file

Last byte of position 16 is unused

17-18

Global error enhancement

Combination of I, H, U, B, 1-8, or NONE.

19-20

Global window enhancement

Combination of I, H, U, B, 1-8, or NONE.

Integer (Two-byte)

21

Position of window

Line number, 0-23. The line closest to the top of the form is 0; 255 means no window.

 

Example

COBOL

DATA DIVISION.
:
:
WORKING-STORAGE SECTION.
01 INFOBUF.
05 NUMBER-OF-ENTRIES PIC S9(4) COMP.
05 ENTRY-LENGTH PIC S9(4) COMP.
05 ENTRY-TABLE OCCURS 1 TIMES.
10 FILE-VERSION PIC S9(8) COMP.
10 NUMBER-OF-FORMS PIC S9(4) COMP.
10 MAX-FIELDS PIC S9(4) COMP.
10 MAX-BUFSIZE PIC S9(4) COMP.
10 SAVE-FIELDS PIC S9(4) COMP.
10 HEAD-FORM PIC X(15).
10 FILLER PIC X.
10 ERROR-ENHANCE PIC X(4).
10 WINDOW-ENHANCE PIC X(4).
10 WINDOW-POSITION PIC S9(4) COMP.
01 INFOBUFLEN PIC S9(4) COMP VALUE 21.
:
:
PROCEDURE DIVISION.
:
:
MOVE SPACES TO INFOBUF.
:
:
MOVE 1 TO NUMBER-OF-ENTRIES.
MOVE 19 TO ENTRY-LENGTH.
CALL "VGETFILEINFO" USING COMAREA, INFOBUF, INFOBUFLEN.

The example shown above illustrates the data declaration of infobuf and infobuflen and the passing of parameters to VGETFILEINFO. Note that before the intrinsic is called, infobuf is initialized to spaces (not zeros). The intrinsic copies 19 two-byte words of information about the open forms file into infobuf.

VGETFORMINFO

Returns information about specified forms to an application.

Syntax

VGETFORMINFO {comarea,infobuf,infobuflen}

Parameters

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 VGETFORMINFO:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VGETFORMINFO sets the following field:

cstatus

Set to nonzero value if call unsuccessful.

infobuf

A record through which you pass the request for form information and to which the intrinsic returns the specified information. This parameter must be initialized to spaces before filling in your request and calling VGETFORMINFO. The layout of infobuf is shown in Table 6-12 “Form Information Buffer” The two required fields of infobuf pass user-supplied parameters to VGETFORMINFO as follows:

nurmofentries

Specifies how many forms you want information about.

entrylength

Indicates how many two-byte words of information (maximum 36 as shown in Table 6-12 “Form Information Buffer”) you want about each form.

The rest of infobuf (beginning with word 3) must consist of entrylength number of two-byte words for each form you want information about. Thus, the total length of infobuf in two-byte words must be as follows;

2 + (entrylength * numofentries)

You may pass one or both of the two permissible keys, which must be passed in the position indicated in the table. Remember that infobuf must be initialized to spaces before filling in the parameters and any key.

infobuflen

Two-byte integer variable set to the number of two-byte words in infobuf.

Discussion

This intrinsic accesses an internal table and places information about forms into infobuf. You tell VGETFORMINFO how many forms and how much information you want about each form.

Table 6-12 Form Information Buffer

Data Type

Position

Contents

Comments

Integer (Two-byte)

1

numofentries

Required

2

entrylength

Required

Character Array (16-byte)

3-10

Form name

Permissible key; last byte of position 10 is unused (15 bytes maximum).

Integer (Two-byte)

11

Form number

Permissible key; forms are ordered within the forms file in alphabetic order, thus this argument reflects the order of the form within the file, not a permanently assigned form numeric identifier. As a result, the number may change if the forms file is recompiled.

12

Number of fields in form

13

Data buffer length in bytes

Character Array (16-byte)

14-21

Name of next form.

Last byte of position 21 is unused.

Character (Two-byte)

22

Repeat option.

First byte of position 22; may be N, A, or R.

22

Next form option

Last byte of position 22; may be C, A, or F.

Integer Array (32-byte)

23-38

Fields in error.

Bit map; bit is on if field is in error.

 

Passing INFOBUF Without Entering Keys

Keys are optional. If you do not supply a key to indicate the first form you want information about, VGETFORMINFO starts with the first form not already reported on by the current call.

As an example, suppose you want information about 3 forms, and you enter form number 6 as a key. VGETFORMINFO returns information about forms 6, 7, and 8. If you enter no keys, VGETFORMINFO returns information about forms 1 through 3.

Table Wraparound

VGETFORMINFO starts over with the first form in the file if you request information about more forms than are in the file or, if when you pass a key, your request goes beyond the end of the file.

Suppose a file has 10 forms. If you request information about 5 of the forms and enter form number 8 as a key, VGETFORMINFO returns information about forms 8 through 10, and then goes to the beginning of the file and returns information about forms 1 and 2.

Error Determination

To enable applications to determine which fields are in error for a given form at run-time, VGETFORMINFO optionally returns a 32-byte bit map containing these error flags to show which fields failed the edit checks.

Each field in a form is represented by a bit in the bit map according to its field creation number. The bit map is a 32-byte logical array to accommodate the maximum of 255 field numbers. The most significant (left most) bit of the first byte in the bit map array represents the field with the field number equal to 1 as assigned by FORMSPEC. For example, the field assigned a field number of 17 would be represented by the most significant bit of the third byte in the array. If a field is in error, the corresponding bit representing that field will be set to a one. Otherwise, the value will be zero.

The bit map is valid for the current form only; information for the current form must be requested by form name key. If the bit map is requested for any other form, it will contain all zeros. Therefore, a value of zero should not be interpreted to mean the field is not in error for the current form, (i.e., the last form retrieved by VGETNEXTFORM). Furthermore, bit positions representing nonexistent field numbers for a given form will contain a value of zero.

To retrieve the bit map, the user-supplied parameter entrylength in infobuf should contain a value of 36. This is to inform VPLUS to supply 36 two-byte words of information pertaining to the form requested. The last 16 two-byte words will contain the bit map indicating which fields are in error.

The infobuflen parameter normally passed to VGETFORMINFO is calculated using the entrylength of 36. To request the bit map for the current form, the calculation is as follows:

2 + (entrylength * numofentries)

where entrylength is equal to 36 and numofentries is equal to 1. Thus, the infobuflen parameter should contain a value of 38 when calling VGETFORMINFO.

For languages which provide bit manipulation capability, the bits can be shifted left or right to determine which bits are on. For other languages, a mask may be used with the bit map to determine whether a bit is on or off. An intrinsic called BITMAPCNV is available to help decode and set bits in the bit map. Refer to Appendix I for more information.

Example

COBOL

DATA DIVISION.
:
WORKING-STORAGE SECTION.
01 INFOBUF.
05 NUMBER-OF-ENTRIES PIC S9(4) COMP.
05 ENTRY-LENGTH PIC S9 (4) COMP.
05 ENTRY-TABLE OCCURS 9 TIMES.
10 FORM-NAME PIC X15.
10 FILLER PIC X.
10 FORM-NUMBER PIC S9(4) COMP.
10 NUMBER-OF-FIELDS PIC S9(4) COMP.
10 BUF-LENGTH PIC S9(4) COMP.
10 NEXT-FORM PIC X(15).
10 FILLER PIC X.
10 REPEAT-OPTION PIC X.
10 NFORM-OPTION PIC X.
01 INFOBUFLEN PIC S9(4) COMP VALUE 62.
:
PROCEDURE DIVISION.
:
MOVE SPACES TO INFOBUF.
:
MOVE 3 TO NUMBER-OF-ENTRIES.
MOVE 20 TO ENTRY-LENGTH.
MOVE "FORM1 " TO FORM-NAME.
CALL "VGETFORMINFO" USING COMAREA, INFOBUF, INFOBUFLEN.

The example shown above illustrates the data declaration of infobuf and infobuflen and the passing of parameters to VGETFORMINFO. Note that before the intrinsic is called, infobuf is initialized to spaces (not zeros). The intrinsic copies 20 two-byte words of information about 3 forms in collating sequence order, beginning with the form named FORM 1, into infobuf.

VGETKEYLABELS

Retrieves global or current form function key labels.

Syntax

        VGETKEYLABELS {comarea,formnorglob,numoflabels,labels}

Parameters

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 VGETKEYLABELS:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VGETKEYLABELS may set the following comarea item:

cstatus

Set to nonzero value if call unsuccessful.

formorglob

Two-byte integer specifying which type of labels are to be retrieved.

  • 0 - Retrieve global labels

  • 1 - Retrieve current form labels

numflabels

Two-byte integer indicating how many labels are to be retrieved. This value must be from 1 to 8, inclusive.

labels

A byte array in which the labels are passed back to an application. The length of the array must be at least numflabels * 16. (Each label is 16 bytes long.)

Discussion

This intrinsic is used to copy global or current form function key labels that have been specified with FORMSPEC, VSETKEYLABEL, or VSETKEYLABELS into an application. Labels for some or for all eight function keys can be copy. The labeloption must be set to one prior to VOPENFORMF.

When this intrinsic is called, any active labels are retrieved from the key label buffers in memory into an application. If there are no active labels, a buffer of spaces is returned. The labels are displayed by calling VSHOWFORM.

Example

COBOL

77 FORM-OR-GLOB     PIC S9(4)COMP.
77 NUM-OF-LABELS PIC S9(4)COMP.
77 KEY-LABELS PIC X(32).
...
MOVE 1 TO FORM-OR-GLOB.
MOVE 2 TO NUM-OF-LABELS.
CALL "VGETKEYLABELS" USING COMAREA,FORM-OR-GLOB,NUM-OF-LABELS,KEY-LABELS.

BASIC
10 INTEGER F,N
20 DIM L$[32]
30 F=1
40 N=2
50 CALL VGETKEYLABELS(C[*],F,N,L$)

FORTRAN
CHARACTER*32 LABELS
INTEGER*2 FORMORGLOB,NUMLABELS
FORMORGLOB=1
NUMLABELS=2
CALL VGETKEYLABELS(COMAREA,FORMORGLOB,NUMLABELS,LABELS)

SPL/PASCAL
INTEGER
FORM'OR'GLOB,
NUM'OF'LABELS;
BYTE ARRAY
LABELS(0:31);
...
FORA'OR'GLOB: =1;
NUM'OF'LABELS:=2;
VGETKEYLABELS(COMAREA,FORM'OR'GLOB,NUM'OF'LABELS,LABELS);

VGETLANG

Returns the native language ID assigned to the forms file. For more information on Native Language Support, see Section 8.

Syntax

        VGETLANG {comrea, langnum}

Parameters

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 VGETLANG:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VGETLANG may set the following comarea items:

cstatus

Set to nonzero value if call is unsuccessful

langnum

Two-byte integer variable to which VGETLANG returns the native language ID assigned to the forms file.

Discussion

The forms file must be opened before calling VGETLANG. Otherwise, cstatus returns a nonzero value. The native language ID returned is always the number assigned to the forms file on the Terminal/Language Menu in FORMSPEC. If the international language ID (-1) is assigned, which means that VSETLANG may be used to specify the native language ID when the application executes, the native language ID returned by VGETLANG will be the number assigned to the forms file (-1), not the number specified with VSETLANG.

Example

COBOL

CALL "VGETLANG" USING COMAREA, LANGNUM.

BASIC

120 CALL VGETLANG(C(*),L)

FORTRAN

CALL VGETLANG(COMAREA,LANGNUM)

SPL/PASCAL

VGETLANG(COMAREA,LANGNUM);

VGETNEXTFORM

Reads the next form from an open forms file into the form definition area of memory.

Syntax

         VGETNEXTFORM {comarea}

Parameters

comarea

Must be comarea name specified when the forms file, from which the form is to be retrieved, was opened with VOPENFORMF. If not already set, the following comarea items must be set before calling VGETNEXTFORM:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

cmode

Set to zero.

nfname

Set to name of next form, or $END, $HEAD, $RETURN, or $REFRESH. See "Communication Area" earlier in this section for more information. (May also be set by prior call to VGETNEXTFORM, VOPENFORMF, VREADBATCH, VINITFORM, VFIELDEDITS, or VFINISHFORM.)

repeatapp

Set to 1 if current form is to be repeated, to 2 if repeated and appended. Note that repeatapp must be set to zero in order to retrieve and display the next form. (Also may be set by a prior call to VGETNEXTFORM, VINITFORM, VFIELDEDITS, or VFINISHFORM.)

freezapp

Set to 1 if next form is to be appended to current form, to 2 if current form is to be frozen before next form is appended. Set to zero in order to clear the current form before displaying the next form. (Also may be set by prior call to VGETNEXTFORM, VINITFORM, VFIELDEDITS, or VFINISHFORM.)

VGETNEXTFORM sets the following items in comarea:

numerrs

Set to zero.

cfname

Set to name of form just read from file.

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

multiusage

Set to 1 if current form is child or sibling of previous form, zero otherwise.

In addition, if a new form has been retrieved (repeatapp is zero), VGETNEXTFORM sets the following items:

cfnumlines

Set to number of lines in form just read (now the current form).

nfname

Set to name of next form to be read from file. See Discussion below for more information.

repeatapp

Set to value read from forms file for this (current) form.

freezapp

Set to value read from forms file for this (current) form.

dbuflen

Set to length (in bytes) of the current form just read from the forms file.

Discussion

VGETNEXTFORM checks the value of repeatapp passed in comarea. If this value indicates the current form is to be repeated, or repeated and appended to itself, it does not read the next form, nor does it update the values of cfnumlines, nfname, repeatapp, freezapp, or dbuflen. Note that a repeating form is repeated until repeatapp is set to zero, either by an application or, for ENTRY, when the user presses NEXT FORM to request the next form, or by the FORMSPEC processing language. If the current form is not to be repeated, VGETNEXTFORM checks nfname to determine which form to read from the forms file.

Example

COBOL

CALL "VGETNEXTFORM" USING COMAREA.

BASIC

11 CALL VGETNEXTFORM(C(*))

FORTRAN

CALL VGETNEXTFORM(COMAREA)

SPL/PASCAL

VGETNEXTFORM(COMAREA);

The examples above call VGETNEXTFORM to retrieve the next form from the forms file and reset the comarea according to the values in the next form.

VGETSAVEFIELD

Copies contents of the specified save field from save field buffer in memory to an application.

Syntax

VGETSAVEFIELD {comarea,sfname,sfbuf,buflen,actualen}

Parameters

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 VGETSAVEFIELD:

cstatus

set to zero.

language

set to the code identifying the programming language of the calling program.

comarealen

set to total number of two-byte words in comarea. Must be at least 70 words in length.

VGETSAVEFIELD may set the following comarea item:

cstatus

set to nonzero value if call is unsuccessful.

sfname

is a character string in the application which contains the name of the save field.

sfbuf

is a character string in the application to which the contents of the save field is copied.

buflen

is a two-byte integer variable which specifies the number of bytes in sfbuf.

actualen

is a two-byte integer variable which specifies the number of bytes actually moved to sfbuf.

Discussion

VGETSAVEFIELD transfers the contents of the save field specified by sfname to a variable in an application.

If the number of bytes specified by buflen is less than the length of the save field, the right most bytes are truncated. Following a successful transfer, actualen is set to the actual number of bytes transferred to sfbuf.

VGETSAVEFIELD does not convert the data moved to the application variable.

Example

COBOL
CALL "VGETSAVEFIELD" USING COMAREA SFNAME SFBUF BUFLEN ACTLEN.

SPL
VGETSAVEFIELD(COMAREA,SFNAME,SFBUF,BUFLEN,ACTLEN);

These calls will transfer the contents of the save field specified by SFNAME to SFBUF. If the call is successful, ACTLEN will contain the exact number of bytes transferred.

VGETSCPDATA

Returns information about the cursor position by field number and row and column on a VPLUS screen.

Syntax

VGETSCPFIELD {comarea,fieldnum,screenrow,screencol} 

Parameters

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 VARMSCP:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea. Must be at least 70 words in length.

fieldnum

Two-byte integer variable to which VGETSCPFIELD returns the field number of the field where the cursor was last positioned when the read terminated.

screenrow

Two-byte integer variable to which VGETSCPDATA returns the physical row number on the screen where the cursor was last positioned when the read terminated.

screencol

Two-byte integer variable to which VGETSCPDATA returns the physical column number on the screen where the cursor was last positioned when the read terminated.

Discussion

When VREADFIELDS terminates, the cursor position on the screen is tracked and retrieved by VGETSCPFIELD. The information contains the field number of the field in which the cursor was positioned when the read was terminated. No cursor position information is available if a VREADFIELDS retry occurs.

VGETSCPDATA returns the physical position of the cursor on the screen by row and column number. Rows are numbered from top to bottom and columns are numbered from left to right.

NOTE: The row and column information returned by VGETSCPDATA is raw physical information and may not directly correspond to actual elements of the user interface.

Like VGETSCPFIELD, VGETSCPDATA returns a -1 in fieldnum if:

  • The cursor was not positioned within a field when the read terminated.

  • No cursor position information is available when VGETSCPDATA is called.

  • The cursor is positioned within a multi-line field and beyond the first line of the field.

VGETSCPDATA should be called after each VREADFIELDS since it first retrieves the cursor position information, then deletes the cursor position information upon procedure completion.

Example

COBOL 
CALL "VGETSCPDATA" USING COMAREA
FIELDNUM SCREENROW SCREENCOL.

SPL
VGETSCPDATA (COMAREA,FIELDNUM,
SCREENROW,SCREENCOL);

These examples return the cursor position on the last read in the fieldnum, screenrow and screencol variables.

VGETSCPFIELD

Returns information about the cursor position by field number on a VPLUS screen.

Syntax

VGETSCPFIELD {comarea,fieldnum} 

Parameters

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 VARMSCP:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea. Must be at least 70 words in length.

fieldnum

Two-byte integer variable to which VGETSCPFIELD returns the field number of the field where the cursor was last positioned when the read terminated.

Discussion

When VREADFIELDS terminates, the cursor position on the screen is tracked and retrieved by VGETSCPFIELD. The information contains the field number of the field in which the cursor was positioned when the read was terminated. No cursor position information is available if a VREADFIELDS retry occurs.

VGETSCPFIELD returns a -1 in fieldnum if:

  • The cursor was not positioned within a field when the read terminated.

  • No cursor position information is available when VGETSCPFIELD is called.

  • The cursor is positioned within a multi-line field and beyond the first line of the field.

VGETSCPFIELD should be called after each VREADFIELDS since it first retrieves the cursor position information, then deletes the cursor position information upon procedure completion.

Example

COBOL 
CALL "VGETSCPFIELD" USING COMAREA FIELDNUM.

SPL
VGETSCPFIELD(COMAREA,FIELDNUM;

These examples return the cursor position on the last read in the fieldnum variable.

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.

comrealen

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 “Numeric Type Conversions” 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.

The default behavior for VGETPACKED and VGETZONED is to produce an unsigned result. If a signed result is desired, the negative of the number of digits in the receiving variable should be passed in the "numdigits" variable. For example, if the number of digits in the receiving variables is 6, and a signed result is desired, then -6 should be placed in "numdigits".

Table 6-13 Numeric Type Conversions

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 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
VGETDINT

VGETREAL

VGETLONG

Integer*2
Integer*4
Real Double
Precision

BASIC

VGETINT
VGETREAL
VGETLONG

Integer
Real
Long

SPL

VGETINT
VGETDINT

VGETREAL
VGETLONG

Integer
Double
Real
Long

COBOL

VGETINT
VGETDINT

S9-S9(4)COMP S9(5)-S9(9)COMP

PASCAL

VGETINT
VGETDINT

VGETREAL

VGETLONG

Subrange -32768..32767 Integer
Real
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.

VGETYYYYMMDD

Converts data in the data buffer to a eight-byte character value and copies it to an application.

Syntax

VGETYYYYMMDD {comarea,fieldnum,variable}

Parameters

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 VGETYYYYMMDD:

cstatus

set to zero.

comarealen

set to total number of two-byte words in comarea. Must be at least 70 words in length.

VGETYYYYMMDD may set the following comarea item:

cstatus

set to nonzero value if call is unsuccessful or requested field has an error.

fieldnum

is a two-byte integer variable which specifies the number assigned to the field by FORMSPEC

variable

is a character string in the application into which the converted value is placed

Discussion

VGETYYYYMMDD transfers the contents of the field specified by fieldnum to a variable in an application. The contents of the field are stored in a data buffer from which the value is taken. This value is converted to YYYYMMDD format and the converted value is placed in the application variable. The YYYYMMDD format is an 8-byte ASCII value, for example, 19961225.

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.

Refer to the VGETtype intrinsic description in the Data Entry and Forms Management System VPLUS Reference Manual for related information.

Example

COBOL
CALL "VGETYYYYMMDD" USING COMAREA FIELDNUM VARIABLE.

SPL
VGETYYYYMMDD(COMAREA,FIELDNUM,VARIABLE);

These calls will convert the contents of the data buffer corresponding to the field specified by FIELDNUM and place the converted value into VARIABLE.

VINITFORM

Initializes fields in data buffer according to specifications defined in the initialize phase of field definition. Both VOPENFORMF and VGETNEXTFORM must have been executed successfully prior to calling VINITFORM.

Syntax

         VINITFORM {comarea}

Parameters

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 VINITFORM:

cstatus

Set to zero

comarealen

Set to total number of two-byte words in comarea.

VINITFORM may set the following comarea values:

cstatus

Set to non-zero value if call unsuccessful.

numerrs

Set to total number of fields in which errors were detected.

nfname

Set to new next form name, if name changed by processing specifications.

repeatapp

Set to new current form code, if code changed by processing specifications.

freezapp

Set to new next form code, if code changed by processing specifications.

Discussion

Certain values may be assigned to fields as initial values. These values are determined by special processing specifications that are explicitly or implicitly defined as part of the initialize phase of field processing using FORMSPEC. These values include any initial values specified on the Field Menus for the form. If no initial values were specified, all fields are initialized to blanks by VINITFORM. If the form being initialized is a child or sibling to the previous form, data from the previous form is transferred to this form (with conversion if necessary) before initializations occur. If a field in a child or sibling form must be initialized to blanks, use $EMPTY as an initial value.

VINITFORM only resets the field error flag if the field is initialized explicitly by initialization phase (INIT) processing specifications.

Example

COBOL

CALL "VINITFORM" USING COMAREA.

BASIC

140 CALL VINITFORM(Cl(*))

FORTRAN

CALL VINITFORM(COMAREA)

SPL/PASCAL

VINITFORM(COMAREA);

The calls shown above set initial values in the data buffer area of memory according to initialize specifications defined for each field in the current form.

VLOADFORMS

Loads specified forms into terminal local form storage memory.

Syntax

VLOADFORMS {comarea,numofforms,formsloaded,forms}

Parameters

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 VLOADFORMS:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VLOADFORMS sets the following items in comarea:

cstatus

Set to nonzero value if call unsuccessful.

numofforms

Two-byte integer value, between 1 and 255, inclusive, indicating the number of forms to be loaded.

formsloaded

Two-byte integer value indicating the number of forms that were successfully loaded.

forms

The names of the forms to be loaded. Each name can be up to 15 characters and is stored in a 16-byte character array with a one byte filler that is not part of the name.

Discussion

This intrinsic is used on terminals having local form storage. VLOADFORMS loads the forms named in forms into terminal local form storage memory in the order they are specified. It may not be possible to load all the forms named because of a limit of available space in local form storage or in the form storage directory (set with formstoresize prior to VOPENTERM and VOPENFORMF). When there is no more space, any other forms named in forms are ignored. The value returned in the formsloaded parameter is:

formsadded + formsalreadypresent

where formsadded is the number of forms specified in the forms parameter that were actually loaded into the local storage of the terminal and formsalreadypresent is the number of forms specified in the forms parameter that were confirmed to already exist in the local storage. Because forms are loaded by form name, family relationships are ignored. Multiple family members can be loaded at the same time.

Note that the terminal keyboard may be locked briefly while VLOADFORMS verifies whether or not a form was loaded. In case keys are pressed during this time, the terminal beeps to indicate that the keystrokes and/or entered data are lost. You can avoid this by not calling VLOADFORMS between calls to VSHOWFORM and VREADFIELDS. Refer to the discussion on "Local Forms Storage" earlier in this section.

Example

COBOL

77 NUM-OF-FORMS         PIC S9(4)COMP.
77 FORMS-LOADED PIC S9(4)COMP.
77 FORMS PIC X(16).
:
MOVE 1 TO NUM-OF-FORMS
MOVE "FORMA "TO FORMS.
CALL "VLOADFORMS" USING COMAREA, NUM-OF-FORMS, FORMS-LOADED, FORMS.

BASIC

10 INTEGER N,F
15 DIM F$[16]
20 N=1
30 F$="FORMA "
40 CALL VLOADFORMS(C[*],N,F,F$)

FORTRAN

INTEGER*2 NFORM,FLOAD
CHARACTER*16 FORMS
NFORM=1
FORMS="FORMA "
CALL VLOADFORMS(COMAREA,NFORM,FLOAD,FORMS)

SPL/PASCAL

INTEGER
NUM'OF'FORMS,
FORMS'LOADED;
BYTE ARRAY
FORMS(0:15);
:
NUM'OF'FORMS:=1;
MOVE FORMS:="FORMA ";
VLOADFORMS(COMAREA,NUM'OF'FORMS,FORMS'LOADED,FORMS);

VMERGE

VMERGE is a new VPlus utility that allows you to combine two or more separately-compiled VPlus forms files into a single forms file, which may then be used with an application program to manage the entry and/or retrieval of data.

Combining multiple forms files with VMERGE provides the following advantages:

  • Some file size limitations can be overcome. Since there are limitations on how many physical records can be placed in a VFORM file, VPlus users sometimes find that they cannot use a single forms file to hold all the forms their application requires. With VMERGE, it is possible to add more forms (from a second forms file) to the ones in the initial forms file, even if the first is at or near the maximum size.

  • It is sometimes easier to maintain a large forms file as several separately compiled "modules" that can then be combined with VMERGE rather than to maintain one large forms file.

Overview

VMERGE usually resides in PUB.SYS. It may be run on either MPE/iX or MPE V.

Before VMERGE is invoked, you must specify two input forms files and one output file. The input files are specified with file equations for the formal designators VMASTER and VAUX. The output file is specified with a file equation for the formal designator VOUTPUT. VMASTER and VAUX must exist, and each may be of type VFORM (slow forms file) or VFAST (fast forms file). VOUTPUT is created by the VMERGE utility and is of type VFAST.

As VMERGE runs, informative messages are presented on $STDLIST. If any problems are encountered, appropriate error messages are displayed. These message are described in the "VMERGE Messages" section in this article.

Forms File Handling by FORMSPEC and VMERGE

VPlus forms files exist in files with two different file codes: VFORM (slow forms file) and VFAST (fast forms file). VFORM files are created and modified with FORMSPEC. VFORM files contain the "source" for each form in the file, coded in a way that FORMSPEC can understand. When a forms file is compiled by FORMSPEC, "object" forms are added to the VFORM file. The object forms are accessed when the forms file is used with ENTRY or another application program that invokes the VPlus intrinsic functions.

When you use FORMSPEC to compile a VFORM file, you may request the creation of a fast forms file. This file contains only the object forms for the forms in the specified VFORM file. Processing the VFAST file is fast because the file is smaller than its corresponding VFORM file. That is, the fast forms file does not contain source forms and, therefore, can be accessed faster. Since a fast forms file does not contain source forms, it cannot be modified by FORMSPEC.

Both VFORM and VFAST files are limited in the number of records they can hold. However, the problem is more severe with VFORM files since they contain both source and object forms.

Previously, the only way to create a fast forms file was by compiling a VFORM file with FORMSPEC. Consequently, you might have been unable to include forms that theoretically could have fit into a VFAST file, since the source and object forms might have been too large to fit into a VFORM file. Now, VMERGE gives you an alternate method for generating VFAST files that contain additional forms. However, VFAST files still have limited capacity, and so there are still limits on the total number of forms you can place in a forms file, even using VMERGE.

Initial analysis shows that the ratio of fast form file size to slow form file size is around 1/3 to 1/10. This suggests that you can expect to combine forms from three or more nearly full (to FORMSPEC) forms files into one forms file, by using VMERGE. However, this is an estimate only, since non-typical forms files may vary considerably in their object to source ratios.

Input File Compatibility

Not all forms files can be successfully combined using VMERGE. The input forms files must be "compatible" in order to be combined with VMERGE. The compatibility factors are:

  • Form names -- the same form name may not appear in both the VMASTER and the VAUX files.

  • Save fields -- if both input files use save fields, the specifications for both files must be identical in all respects: names of save fields, lengths, data types, and initial values. The save fields must also be defined in the same order. It is permissible for one file to use save fields and the other not to do so.

  • Global function key labels -- if both input files define global function key labels, the specifications for both files must be identical in all respects. It is permissible for one file to define global function key labels and the other not to do so. In this case, the global function key labels from the file which contains them will be retained in the output file.

  • Terminal selection and language id -- both input files must have exactly the same set of terminals selected and the same Forms File Language specified (from FORMSPEC Terminal/Language Selection Menu).

There are a number of forms file characteristics that may differ between the two input files that are not serious enough for VMERGE to consider the two files as incompatible. These include: head form name, error enhancement, window display line, error window color, and window enhancement. The characteristic found in the VMASTER file is retained in the VOUTPUT file.

Application Requirement for Combined Forms Files

VMERGE takes two FORMSPEC-compiled forms files specified by the VMASTER and VAUX file designators, extracts the object forms from each file, and places these forms in a VFAST file specified by the VOUTPUT file designator.

Every forms file has a $HEAD form designated for it. Additionally, every form in a forms file has a "Next Form" designated for it. Next Form may be $HEAD or it may be the name of another form in the file. In order to compile a forms file, FORMSPEC requires that any form named as the $HEAD or as a Next Form exist in the file. Consequently, it is impossible for a form in the VMASTER forms file to refer to a form in the VAUX forms file as its Next Form and vice versa.

Therefore, the application program used with a combined forms file must be coded to sequence among the forms in the combined forms file without depending on the Next Form designation. The Next Form designation can only be used when it and the current form originated from the same forms file.

VMERGE users should be aware that VMERGE makes the $HEAD form from VMASTER the $HEAD for VOUTPUT. If data entry operators are used to seeing the $HEAD form from the VAUX file, they may be surprised if this $HEAD form is no longer what is displayed when they bring up their application.

Technical Reference

VMERGE normally resides in PUB.SYS; if it is moved from PUB.SYS, it must be moved to a group with "DS" capability.

VMERGE is invoked with the following command:

        :RUN VMERGE.PUB.SYS

Before invoking VMERGE, three file equations must be given. The two VMERGE input forms files are indicated by the file designators VMASTER and VAUX. VMASTER and VAUX must designate existing forms file, with file codes VFORM or VFAST. The VMASTER and VAUX files must have been compiled with a recent version of FORMSPEC. If an input file is provided that does not meet this criterion, a message is given, and VMERGE processing halts.

VMERGE's output VFAST forms files is indicated by the file designator VOUTPUT. If the designated file already exists and has the file code VFAST, then it is purged and recreated by VMERGE. If the file exists but has a file code other than VFAST, the file is not purged, a warning message is given, and VMERGE halts.

The files used by VMERGE are opened for exclusive use to avoid concurrent update problems.

Two JCWs (job control words) are defined for use with VMERGE: VMERGETERSE and VMERGEERROR. If the user sets VMERGETERSE to 1 before running VMERGE, then the messages indicating the form names contained in the VMASTER and VAUX files are suppressed. The VMERGEERROR JCW is set by VMERGE after it runs. If VMERGE detected a severe error that prevented the VOUTPUT file from being successfully created, VMERGEERROR is set to 1. If VMERGE successfully created the VOUTPUT file, VMERGEERROR is set to 0.

Example 1: Using VMERGE to Combine Forms Files

Suppose your company has three distinct uses for an order form prepared by a salesperson. The order form is used in the shipping department, the billing department, and the marketing department. Currently the original order form is passed among three clerks who each enter their data using their own VPlus forms files (SHIPFF, BILLFF, and MARKETFF) that are distinct to their respective departments. Your job is to merge the forms files and fix the application program so that one clerk can enter the data for all three departments.

You decide that each of the three application areas (shipping, billing, and marketing) should be selectable by pressing a function key. Once an area has been selected, processing will be performed using the same sequence as when the application for that area existed on its own. Remember that while combining the three applications into one, you will need to examine the effect of $HEAD being different from what two of the original three programs expected. Most likely, you will want to create a new form to serve as the $HEAD for the combined application.

After examining and fixing the application program, you will need to look at the forms files and make them compatible, if they are not already. You will need to make sure that the save fields, if any, have distinct names and are identical in each of the forms files that uses them. Additionally, you will need to check that the global function key specifications are compatible in the three forms files. Note that in some cases incompatibilities may be so extensive that it will be impossible to merge the forms files.

Next you determine what order to merge the forms files together. Suppose in this example that the marketing forms file is much more volatile than the other two. Therefore, you decide that this file should be the last one merged. You also need to decide which form your combined application should use as its $HEAD. Suppose in this example you depend on the $HEAD form from BILLFF being the $HEAD of the combined forms file.

Combining the forms files is accomplished in two stages. In the first stage you enter:

     :FILE VMASTER=BILLFF 
:FILE VAUX=SHIPFF
:FILE VOUTPUT=INTERFF
:RUN VMERGE.PUB.SYS

VMERGE creates the intermediate forms file INTERFF.

In the second stage you enter:

     :FILE VMASTER=INTERFF 
:FILE VAUX=MARKETFF
:FILE VOUTPUT=COMBOFF
:RUN VMERGE.PUB.SYS

VMERGE creates the final forms file COMBOFF. You may wish to keep the intermediate forms file, INTERFF, so you won't need to recreate it if only MARKETFF changes.

Now you could test COMBOFF with your combined application program.

Example 2: Using VMERGE to Divide a Forms File

Another use of VMERGE is to divide an existing forms file into two or more smaller forms files. This might be desirable if different forms in the original forms file were going to be modified by different people, or if compiling the entire forms file takes a long time.

When VMERGE is used to divide a file, there are few compatibility problems since the original form file is already "merged". You will have to be careful not to introduce incompatibilities (for example, refer to the $HEAD and Next Form issues discussed earlier) as a result of dividing the file.

Suppose you want to remove forms F1, F2, and F3 from a forms file named BIGFF and place them into another forms file, LITTLEFF. The F1, F2, and F3 forms are changed often, and you want to separate them out in order to minimize the time it takes to recompile each time changes are made.

First, you would FCOPY BIGFF to LITTLEFF by entering the following command:

     :FCOPY FROM=BIGFF;TO=LITTLEFF;NEW

Second, you would run FORMSPEC on BIGFF to delete forms F1, F2, and F3. You would need to correct the Next Form fields for any affected forms.

Third, you would probably want to take advantage of some of FORMSPEC's batch mode facilities to delete all but the F1, F2, and F3 forms from LITTLEFF (see the Deleting Forms Using FORMSPEC's Batch Mode Facilities section below).

Fourth, you would compile both forms file to verify that no $HEAD or Next Form dependencies exist. The compilation for BIGFF will be lengthy, but it will only need to be done once.

Fifth, you would make your changes to the forms in LITTLEFF and add additional forms that could not be put into BIGFF due to size limitations.

After you had taken all these steps you could combine the two forms files with VMERGE:

  :FILE VMASTER=BIGFF 
:FILE VAUX=LITTLEFF
:FILE VOUTPUT=SUPERFF
:RUN VMERGE.PUB.SYS

Check your application using the SUPERFF forms file.

VOPENBATCH

Opens existing batch file for processing; or, if the specified file is new, creates a batch file and then opens it for processing.

Syntax

        VOPENBATCH {comarea,batchfile}

Parameters

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 VOPENBATCH:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VOPENBATCH sets the following comarea items:

nfname

Set to the name of the form corresponding to the record identified by recnum.

recnum

Set to zero if new file opened; to the next sequential record number if existing file opened.

numrecs

Set to zero if new file opened; to the number of nondeleted records in file if existing file opened.

VOPENBATCH may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

batchfile

Character string of up to 36 characters (including a terminator) that identifies the batch file being opened. Specified name can be any fully qualified MPE file name.

Discussion

VOPENBATCH opens the specified batch file for processing by the calling program. The batch file may be an existing file or a new file.

Existing File

If the named file already exists, VOPENBATCH initializes recnum to the record number of the next record in the file, and numrecs to the total number of existing batch records. Thus, a user resuming collection does not overwrite data collected into previous batch records. VOPENBATCH sets nfname to the name of the form associated with the batch record to be collected. This record is identified by recnum. VOPENBATCH keeps track of forms sequence in order to associate a form with a record. For example, if a batch file is closed after record 6 of FORMA was collected, and FORMA is a repeating form, the batch file starts with record 7 FORMA when it is next opened by VOPENBATCH.

VOPENBATCH also resets the global environment (save fields and so forth) to the environment existing when collection stopped. (All this information is derived from the file labels preceding each file.)

New File

If the named file does not exist, VOPENBATCH creates a new file with the specified name and sets recnum and numrecs to zero. A new batch file created by VOPENBATCH has the following characteristics:

  • Non-KSAM file

  • USASCII coded data

  • Fixed-length records

  • No carriage control

  • :FILE command allowed (use actual file designator)

  • Update access

  • Exclusive (nonshared) access

  • No dynamic locking

  • No multirecord access

  • Normal buffering

Record Format

The size of the fixed-length batch file records must be large enough to hold the largest data buffer used by the forms file associated with the batch file, plus 10 two-byte words for batch record control information. If the largest data buffer is an even number of bytes, an additional two-byte word is added before the control information. This batch record information consists of:

2 bytes (logical)

— Delete flag (TRUE if record deleted)

16 bytes (character)

— Current form name + extra character

2 bytes (logical)

— Data buffer length

Total = 20 bytes

The above batch record information is written at the end of each record in the batch file, starting on a two-byte word boundary. To illustrate, assume the record size is 74 bytes, and the data only requires 35 bytes (bytes are numbered from 1):

Labels

In addition, VOPENBATCH creates sufficient user labels (each 256 bytes long) to hold any save field buffers, plus 176 bytes for the collection environment and the forms file version.

The length of the save field buffers depends on how many (if any) save fields were defined for the form and the length of each. The collection environment consists of the forms file name and version number, the next form name, and 122 bytes of system information. This information is stored as follows:

# of Bytes

2

— Product number

2

— (System use)

4

— Forms file version (date and time of compilation)

16

— Next form name

28

— Forms file name

120

— Reserved for system use

4

— Number of nondeleted records in batch file

     Total = 176

For example, assume that the save fields buffer requires 242 bytes. The following user labels are created by VOPENBATCH:

LABEL 0 — Contains first 80 bytes of Save Fields buffer

LABEL 1 — Contains remaining 162 bytes of Save Fields buffer

Note that the length of the save fields buffers is determined by taking the number of bytes in each save field, summing them together, adding one byte, and then, if odd, rounding the total up to an even number.

Creating Your Own Batch File

Should you want to create your own batch file rather than calling VOPENBATCH, you must build the file using the above record format and user label requirements. Also, if you create a batch file with variable-length or undefined-length records rather than fixed-length records, browsing of the batch file is not allowed. Undefined-length records are formatted like fixed-length records.

If you do, nevertheless, want to create a batch file with variable-length records for data collection only, the batch file information is stored immediately following the data in each record. Assume a variable-length record with 35 bytes of data:

The total size of this record is 56 bytes. Depending on the size of the data, other records have varying lengths. The maximum size of the variable-length records must be the size of the largest data buffer (in bytes) plus 20 bytes for the batch record information.

Example

COBOL

       CALL "VOPENBATCH" USING COMAREA, BATCH.

BASIC

       170 CALL VOPENBATCH(C(*),Bl$)

FORTRAN

       CALL VOPENBATCH(COMAREA,BATCH)

SL/PASCAL

       VOPENBATCH(COMAREA,BATCH);

If the requested batch file name is an existing file, it is opened and the user can continue to enter data into the record following the last record that contains data. If the requested batch file name is a new file, VOPENBATCH creates a batch file and data entered at the terminal is written to the first record in the file (record 0).

VOPENFORMF

Opens forms file for access.

Syntax

         VOPENFORMF {comarea,formfile}

Parameters

comarea

The comarea name must be unique for each open forms file. If not already set, the following comarea items must be set before calling VOPENFORMF:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

usrbuflen

BASIC programs only; set to number of two-byte words needed for comarea extension.

labeloption

Set to zero or one.

formstoresize

Set to minus one, zero, or one through 255 to indicate the number of forms allowed in the form storage directory.

VOPENFORMF sets the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

lastkey

Set to zero.

numerrs

Set to zero.

recnum

Set to zero.

dbuflen

Set to zero.

cmode

Set to zero (collect mode).

repeatapp

Set to zero (no repeat/append).

freezapp

Set to zero (clear current form).

printfilnum

Set to zero.

deleteflag

Set to FALSE (all zeros) (used for batch file intrinsics).

cfname

Set to blank.

nfname

Set to name of head form.

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

windowenh

Set to enhancement code defined in forms file.

If the data capture devices are used:

errorlight

Set to default or user specified value.

splitmsgpause

Set to default or user specified value.

formfile

Character string of up to 36 characters (including a terminator) that identifies the forms file being opened. Specified name can be any fully qualified MPE file name.

Discussion

VOPENFORMF opens the specified forms file for processing by the calling application. If the calling application is BASIC, it must provide its own comarea extension immediately following the comarea and specify the size of this extension in usrbuflen. If the application is written in a programming language other than BASIC, a DL area is obtained for use as the comarea extension. In this case, the application must not use the DL area for other functions. Refer to Appendix E for more information on the DL area. The forms file listing gives an estimate of DL to DB area used. You use this estimate with the MAXDATA parameter at PREP or RUN time. The labeloption must be set to one if you are using function key labels.

Example

COBOL

      CALL "VOPENFORMF" USING COMAREA, FNAME.

BASIC

      100 CALL VOPENFORMF(c(*),F1$)

FORTRAN

      CALL VOPENFORMF(COMAREA,FNAME)

SPL/PASCAL

      BYTE ARRAY FNAME(0:34);
:
MOVE FNAME:="FORMSA ";
VOPENFORMF(COM1,FNAME);

VOPENTERM

Opens a VPLUS supported terminal.

Syntax

         VOPENTERM {comarea,termfile}

Parameters

comarea

The comarea name must be unique for each open forms file. The calling program should initialize the entire comarea to zero before calling VOPENTERM. For additional information about about using the pseudo intrinsic .LOC to put and address into a word of the COMAREA, refer to the COBOL II/XL Reference Manual.

In addition, the following comarea items must be set before calling VOPENTERM:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words of comarea.

formstoresize

Set to minus one, zero, or one through 255 to indicate the number of forms allowed in the form storage directory.

VOPENTERM may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

filen

Set to MPE file number of terminal.

identifier

Set to appropriate VPLUS terminal type code.

environ

Set to logical device number of terminal.

labinfo

Set to appropriate number and length of labels used by VPLUS.

If the data capture devices are used:

leftmodule

Set to appropriate value defining terminal.

rightmodule

Set to appropriate value defining terminal.

keyboard

Set to appropriate value defining terminal.

display

Set to appropriate value defining terminal.

termfile

Character string of up to 36 characters (including a terminator) that identifies the terminal. If set to a blank, the session device is used to get the ldev# of the logon terminal. Otherwise, any fully qualified MPE file name can be assigned to the terminal as its formal file designator. If specified, the name must be terminated by a special character (a blank is suggested). Before using a terminal identified by name, the formal designator may be equated to an actual designator with a :FILE command.

Discussion

This intrinsic opens the terminal as a file. If you are running your program as a session with your terminal as the open terminal file, the terminal name should be left blank so that the session device is opened. If you are opening a form, you should call VOPENFORMF before using this intrinsic,

Once the terminal is opened for control by VPLUS, an application should not call system intrinsics to communicate with the terminal. All terminal I/O must be controlled through VPLUS intrinsics.

If you are using an HP 2640B or HP 2644 terminal and the terminal is not in block mode, VOPENTERM asks you to press the BLOCK MODE key; other terminals are set to block mode automatically. The data capture devices are treated as character mode terminals.

Example

COBOL

      77 T1 PIC X(8) VALUE "VTERM
01 COMAREA.
:
:

PROCEDURE DIVISION.
:
OPENTERMINAL.
CALL "VOPENTERM" USING COMAREA, T1.

This example opens the device referenced by the file equation VTERM. If no file equation exists, the default is the logon device.

BASIC

      90 Tl$-#" "
100 CALL VOPENTERM(C(*),T1$)

FORTRAN

      T1=" "
VOPENTERM(COMAREA,T1)

SPL/PASCAL

      MOVE T1:="          ";
VOPENTERM(COMAREA,T1);

The examples shown above open the session device with comarea identified as COMAREA (C(60) for BASIC).

VPLACECURSOR

Allows an application to position the cursor to any input field at run-time.

Syntax

        VPLACECURSOR {comarea,fieldnum}

Parameters

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 VPLACECURSOR:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VPLACECURSOR may set the following comarea items:

cstatus

Set to non-zero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

fieldnum

A two-byte integer that identifies the input field, where a positive number indicates the field number; a negative number indicates the screen order number.

Discussion

VPLACECURSOR allows an application to position the cursor to any input field at run-time. This intrinsic places the cursor to the input field specified by fieldnum. Calling VPLACECURSOR with a positive number indicates the field number; a negative number indicates the screen order number. Using the field number is preferable because if the fields in a form are rearranged, no modification to an application is necessary.

VPLACECURSOR must be called after calling VSHOWFORM. VPLACECURSOR returns an error if the field number or the screen order number does not exist. An error is also returned if the intrinsic is called to place the cursor to a display-only field.

Example

COBOL

     CALL "VPLACECURSOR" USING COMAREA,FIELD-NUM.

BASIC

     120 CALL VPLACECURSOR(C(*),FIELDNUM

FORTRAN

     CALL VPLACECURSOR(COMAREA,FIELDNUM)

SPL/PASCAL

     VPLACECURSOR(COMAREA,FIELDNUM);

VPOSTBATCH

Protects a user-specified portion of the batch file data from a system crash by posting an end-of-file mark after the last record referenced and updating the batch file labels.

Syntax

         VPOSTBATCH     {comarea}

Parameters

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 VPOSTBATCH:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VPOSTBATCH will set the following field:

cstatus

Set to nonzero if called unsuccessful, zero if successful.

Discussion

VPOSTBATCH posts an end-of-file mark after the last record referenced in the batch file and updates the environmental information found in the file label. Refer to the discussion of VOPENBATCH for a description of the environmental information.

If a system crash or power failure occurs while the batch file is open, all data before the end-of-file mark is preserved, and data collection continues from that point. In ENTRY, VPOSTBATCH is called after every 20 records, though you may extend or shorten this posting interval. Two cautions:

  1. Never call VPOSTBATCH while you are in BROWSE mode, or at any time when the last record referenced is not the last record in the batch file. If you call this intrinsic when the last record referenced is in the middle of the file, VPOSTBATCH posts a mark before the actual end of the file, causing all data after this mark to be lost.

  2. The comarea field numrecs, which contains the number of undeleted records in the file, may not be restored correctly after a system crash if batch records have been deleted since the last call to the VPOSTBATCH intrinsic.

Example

COBOL

     CALL "VPOSTBATCH" USING COMAREA.

BASIC

     290 CALL VPOSTBATCH(C(*))

FORTRAN

     CALL VPOSTBATCH(COMAREA)

SPL/PASCAL

     VPOSTBATCH(COMAREA);

VPRINTFORM

Prints the current form on an off-line list device.

Syntax

        VPRINTFORM {comarea,printcnt1,pagecnt1}

Parameters

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 VPRINTFORM:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

printfilnum

Set to file number of the list file to which the form is to be printed. If set to zero, VPRINTFORM opens the device "LP" as the list file and sets printfilnum to the file number of the opened list file.

VPRINTFORM may set the following comarea values:

printfilnum

If VPRINTFORM opened the list file, set to the file number of the open file.

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

printcntl

Two-byte integer that, if set to 1, causes VPRINTFORM to underline each field in the form listing. If set to any other value, fields are not underlined.

pagecntl

Two-byte integer value that determines the carriage control operation performed after a form is listed. May be any of the carriage control codes used by the MPE FWRITE intrinsic, including the following:

     61(octal)      Page eject
320(octal) No line feed or carriage return
zero Carriage return/line feed

Discussion

VPRINTFORM prints the current form to a list file. It is analogous to VSHOWFORM, in that it prints the form and the current data buffer values, except that VPRINTFORM prints the form on a hardcopy device rather than on the terminal. Enhancements obviously cannot be shown directly; the window line and key labels are not printed. The form must have been read into the form definition area of memory by a prior call to VGETNEXTFORM. The information printed depends on what is in the data buffer, which may not necessarily be the same as what is displayed.

The carriage control character specified in the pagecntl parameter is effective after the form is printed.

If the calling program opens the list file, it must supply the file number of this file in printfilnum. If printfilnum is zero, VPRINTFORM opens a list file and sets printfilnum to the file number of the file. VPRINTFORM opens the list file, with the formal and actual file designator FORMLIST, assigns it to the device class LP, and specifies its length as 80 bytes. This is equivalent to using the file equation:

:FILE FORMLIST;DEV=LP;REC=-80

A user may change any of these characteristics with an MPE :FILE command.

Example

COBOL

      CALL "VPRINTFORM" USING COMAREA, UNDERLINE, PAGE.

BASIC

      135 CALL VPRINTFORM(C(*),U,P)

FORTRAN

      CALL VPRINTFORM(COMAREA,UNDRLN,PAGE)

SPL/PASCAL

      VPRINTFORM(COMAREA,UNDERLINE,PAGE);

Each of the calls shown above prints the current form on a list device; if not already open, it opens the device file.

VPRINTSCREEN

Prints the entire contents of a terminal screen to an off-line list device or laser printer during VPLUS execution.

Syntax

        VPRINTSCREEN {comarea, readsize}

Parameters

comarea

If not already set, the following comarea items must be set before calling VPRINTSCREEN:

cstatus

Set to zero

comarealen

Set to the total number of two-byte words in comarea.

printfilenum

Set to the file number of the list file to which the form is printed. If set to 0, VPRINTSCREEN opens the device "LP" as the list file and sets printfilenum to the file number of the opened list file.

VPRINTSCREEN may set the following comarea items.

printfilenum

If VPRINTSCREEN opened the list file, set to the file number of the opened file.

cstatus

Set to a nonzero value if call is unsuccessful.

fileerrnum

Set to the MPE error code if an MPE file error is encountered.

readsize

Two-byte integer, reserved for system use. Must be set to 0.

Discussion

This intrinsic provides the capability for printing the current screen display with function keys, line drawing characters and appended forms, as well as the data on the screen. It differs from VPRINTFORM, which is limited to printing only the data in the form data buffer. However, VPRINTFORM offers the option of underlining fields, which VPRINTSCREEN in LP mode does not.

The programmer can produce copies of VPLUS screens in either of two ways: incorporating VPRINTSCREEN into an application so that screen images can be captured at run-time with their data, or developing a simple utility that allows data to be entered into the screens before calling VPRINTSCREEN to reproduce them. The utility has the advantage of removing the overhead caused by VPRINTSCREEN from the application, while still providing a way to reproduce screens and data for product literature.

VPRINTSCREEN always uses the Pascal HEAP procedures to perform stack allocation. This introduces the risk of conflict for programs written in COBOL, FORTRAN/66 or SPL, because the existing intrinsics would use DLSIZE for stack allocation in these cases. Applications written in these languages must, therefore, follow two rules when calling VPRINTSCREEN. They are:

  1. The language id in the comarea must be set to 5.

  2. The INTRINSIC calling mechanism must be used when calling the VPLUS intrinsics from the main and all interacting parts of the application. For example, with COBOL the application must use:

       :CALL INTRINSIC <intrinsic name>

Refer to Appendix E of this manual, and to the COBOL and Pascal reference manuals, for more information on calling mechanisms.

For applications that use a language id of 5 in the VPLUS comarea, including Pascal, FORTRAN/77 and HPBUSINESS BASIC, VPLUS uses the HEAP procedures for stack allocation, so VPRINTSCREEN can be called in the standard format.

The programmer may implement this feature by defining a function key that allows the user to print the screen contents at any time. This would be useful for providing immediate output during production.

Modes of Operation

VPRINTSCREEN operates in two modes, normal and documentation mode. A VPLUS supported terminal is required for execution of this intrinsic.

Normal Mode

This is the default calling mode for VPRINTSCREEN. When called, the value in the printnumfile word of the comarea is used to determine the list device. If the calling program opens the list file, it must supply the file number of this file in printfilenum VPRINTSCREEN opens the list file with the formal and actual file designator FORMLIST, assigns it to the device class LP, and specifies its length as 80 characters. This is equivalent to using the file equation:

   :FILE FORMLIST;DEV=LP;REC=-80

The user may change any of these characteristics with a :FILE command.

NOTE: It is recommended that VPRINTSCREEN and VPRINTFORM not be used in the same program. Since the same list is used for both listings, output from the two calls will be intermixed.

Each time VPRINTSCREEN is called, a PAGE EJECT is performed at the end of the print operation.

Documentation Mode

You require TDP in order to use VPRINTSCREEN in this mode. VPRINTSCREEN, in conjunction with TDP, provides the capability to print screen contents on a laser printer (HP2680A or HP2688A). In this mode, field highlighting other than color, borders, alternate character sets and active function keys are captured and converted to the requisite font for printing on the laser printer.

Documentation mode is enabled by setting a JCW before running the program. It is:

    :SETJCW VPRINTJCW=1

When VPRINTJCW is set to 1, the list file FORMLIST is NOT opened. Instead, a temporary file called EPOCLIST is created (or appended to, if it already exists). EPOCLIST can be saved and renamed on completion of the screen capture, then input to TDP and 'finaled'. The user can add text to the file or include it in a separate TDP file. Refer to the TDP Reference Manual for more information on use and include files.

The following files are sample files supplied on the FOS installation tape. They should be restored to a local group to be used by applications using VPRINTSCREEN in documentation mode. To accomplish this, mount the FOS tape and perform the following restore commands:

:file t;dev=TAPE	:restore *t;V@.HP32209.HPPL89;local;show

These files may also be a non-local group, provided the application supplies a file equation, T. E.,

:file VSETUP=VSETUP.othergroup.otheraccount
Filename (in HP32209.HPPL89)    Description
---------------------------------------------------------------------
VENV80 environment file for HP2680 printer
VENV88 environment file for HP2688 printer
VSETUP TDP include file
VEPOCUSE TDP use file for merging screens
VPRTDEMO demo program for VPRINTSCREEN"

In order to print the forms on a laser printer, an environment file must be created (if it does not already exist). Refer to the IFS/3000 Reference Guide for more information. The environment files for the HP2680 and HP2688 laser printers are VENV80 and VENV88 respectively. All environment files must include the font ids listed under "Limitations" below.

EPOCLIST uses VSETUP, a TDP include file, as the default file to reference the environment files, which must be accessible to TDP in order for EPOCLIST to be printed. If an environment file other than VENV80 or VENV88 is used, EPOCLIST must be modified to reference this file, and the font definitions from VENV80 and VENV88 must be included in it (see "Limitations" below).

Printing Screens from TDP. To print the contents of EPOCLIST to a laser printer, follow these steps:

  1. :PURGE (or :RENAME) EPOCLIST

  2. :SETJCW VPRINTJCW=1

  3. :RUN <your application program>

  4. Use the print function wherever it is available to save the screen contents, including data, in EPOCLIST.

  5. Exit the application.

  6. :SAVE EPOCLIST

  7. :RENAME EPOCLIST, <new name> If you do not rename EPOCLIST, the output generated the next time the application is run will be appended to the existing file.

  8. :RUN TDP.PUB.SYS

  9. Text in the file and execute the command, "Final from <new name> to *HP2680" (or HP2688)

The screens will be printed out, one per page. Step 8 and 9 may be specified in a job stream.

Merging Screens with a TDP File. You can include screens in an existing TDP document easily by using the file VEPOCUSE, a TDP use file that divides EPOCLIST into separate files containing one screen per file. The VSETUP file must be included as one of the first statements of the TDP document so that the correct environment file is referenced for printing the screens.

Follow these steps:

  1. :RUN TDP Clear the workspace.

  2. :USE VEPOCUSE Answer the prompts, and enter a PREFIX. VEPOCUSE separates the old file into new files, each containing one screen.

  3. Text in the TDP document and include each screen file in the correct place.

It is recommended that screen files be included as separate, individual files in a document, rather than being incorporated directly into the text, because EPOCLIST has a record size of 168 bytes and most document files are set to 80 bytes.

These files may also be a non-local group, provided the application supplies a file equation, T. E.,

:file VSETUP=VSETUP.othergroup.otheraccount
Filename (in HP32209.HPPL89)    Description
---------------------------------------------------------------------
VENV80 environment file for HP2680 printer
VENV88 environment file for HP2688 printer
VSETUP TDP include file
VEPOCUSE TDP use file for merging screens
VPRTDEMO demo program for VPRINTSCREEN"

Limitations

The following limitations pertain to the use of VPRINTSCREEN.

  • Procedure calls must be modified in order to call the intrinsic from a language that does not use a VPLUS language id of 5 in the comarea, for example, COBOL, SPL and FORTRAN/66.

  • It uses additional stack resources.

  • Native Language support is NOT available for VPRINTSCREEN. To print a screen in another language, you require a LOCALIZED environment file which maps to the following fonts:

         c = full bright
    g = half-bright inverse video
    d = normal
    l = line-draw
    m = math
  • The current environment files do not distinguish between full bright and half bright, but the code is set up to do so.

  • Screen images cannot be scaled; fonts come in one size only.

  • The maximum TDP record size is 168 characters. A single line in a screen may easily exceed this limit if it contains may escape sequences, in which case the line may be truncated.

  • TDP macros 5-9 are used to minimize truncation, but some screens will reach the limit anyway. If you use your own macros 5-9, some inconsistencies may appear when text and screens ar merged.

  • TDP may indicate that errors have occurred when, in fact, there are none. The most common error messages are: "Unrecognizable command" and "n characters have been truncated".

Example

This is a smaple EPOCLIST file.

*>>DATE: FRI, MAY 3, 1987, 11:19AM
if main in hpvsetup.pub
image 28
need 28
>>>>>>screen formatting commands<<<<<<
*>>END VPRINTSCREEN B.05.00

VPUTBUFFER

Copies data from an application to the data buffer in memory.

Syntax

        VPUTBUFFER {comarea,buffer,buflen}

Parameters

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 VPUTBUFFER:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea. Must be at least 70 words in length if the ARB feature is used.

buffercontrol

Set bit 15 to 1 to indicate that data is to be transformed according to the ARB specifications.

VPUTBUFFER may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful

numerrs

May be decremented as a result of new data replacing data in field with error.

bufferstatus

Bit 15 set to 1 if data conversion is successful

buffer

Character string in a application containing the data to be copied to the data buffer in memory.

buflen

Two-byte integer variable that specifies the number of bytes to be copied to the data buffer in memory. The comarea item dbuflen, which contains the size of the data buffer in memory, may be used as this parameter.

Discussion

This intrinsic transfers data from a buffer in an application to the data buffer in memory. The length of the data moved is based on the number of bytes specified in the buflen parameter and the number of bytes in the largest data buffer in the forms file, whichever is less. The length of the buffer assigned to the current form is not considered since the user may intend the data for another form with a longer buffer length.

For example, assume there are three forms in the forms file:

  • Form A dbuflen = 100 bytes

  • Form B dbuflen = 200 bytes

  • Form C dbuflen = 75 bytes

In this case, the maximum data buffer length is 200 bytes. If the current form is form A and the user calls VPUTBUFFER with a user buffer length (buflen parameter) of 200, he may intend to call VGETNEXTFORM to get form B and then VSHOWFORM to display form B with the 200 bytes of data moved to the data buffer with VPUTBUFFER.

Fewer bytes than the data buffer can hold may be transferred; the remaining space in the data buffer is not changed.

The data moved to the data buffer is exactly as it appears in the application buffer. (If you want the data converted to USASCII in the data buffer, you must use VPUTtype, where type is the data type of the field in an application.) When the data is displayed, it is moved to each field in the form in sequence from left to right, top to bottom. If any field being replaced by user data contained an error, VPUTBUFFER clears the error flag for the field and decrements numerrs.

Special Considerations

Designers using the ARB feature in VPUTBUFFER should be aware that damaging run-time errors could occur if the application is inadvertently run on a system that has a VPLUS version earlier than B.05.00.

To prevent this, the designer should do three things:

  1. Document the product with a clear warning requiring VPLUS B.05.00 or later.

  2. Use the VPLUS intrinsic HP32209 in the code. This intrinsic checks to make sure you are using the proper VPLUS version. If not, the application should terminate with an appropriate message.

  3. Check offset 65 (bufferstatus) in the comarea on return from VPUTBUFFER. Bit 15 will be set to 1 if VPUTBUFFER performed the conversion successfully. In other words, the application must check both status and bufferstatus to be sure that the data was correctly converted.

Example

COBOL

       01 DAT1.
03 FIRSTNAME PIC X(6).
03 LASTNAME PIC X(18).
.
.
.
ACCEPT DAT1.
CALL "VPUTBUFFER" USING COMAREA, DAT1, DBUFLEN.

BASIC

       235 L1=24
240 CALL VPUTBUFFER(C(*),D1$,L1)

FORTRAN

       CALL VPUTBUFFER(COMAREA,DAT1,DBLEN)

SPL/PASCAL

       BYTE ARRAY DAT1(0:23);
VPUTBUFFER(COM1,DAT1,LEN);

The following calls transfer 24 bytes from an application area, DAT 1 to the data buffer. In this example, the longest dbuflen is assumed to be 80 bytes.

VPUTFIELD

Copies data from an application into a specified field in the data buffer in memory.

Syntax

        VPUTFIELD {comarea,fieldnum,fieldbuf,buflen,actualen,nextfldnum}

Parameters

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 VPUTFIELD:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VPUTFIELD may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

numerrs

May be decremented if new value is moved to a field which has error flag set.

fieldnum

Two-byte integer variable containing the number assigned to the field in the data buffer by FORMSPEC.

fieldbuf

Character string in an application containing the data to be copied to the specified data buffer field.

buflen

Two-byte integer containing the number of bytes to be copied from fieldbuf to the field identified by fieldnum.

actualen

Two-byte integer that specifies the number of bytes actually copied.

nextfldnum

Two-byte integer to which VPUTFIELD returns the number of the next field in screen order. If there are no more fields, it returns zero.

Discussion

The data in an application is copied to the field in the data buffer identified by its field number. Note that the field number is a unique number assigned to the field by FORMSPEC when the form is first created. The number assigned to a field by FORMSPEC does not change regardless of any changes to the field's position in the form or to its length. The field number can only be changed with the batch command, RENUMBER, as described in Section 7. The field number must not be confused with the screen order number, which is the field's position in the data buffer and corresponds to its position in the form.

If the field is shorter than the data transferred to it, the data is truncated on the right. If the field is longer than the data transferred to it, the data, if any, in the remaining space in the field is not changed.

If the field whose data is being replaced contained an error, VPUTFIELD clears the field's error flag, and decrements numerrs.

Note that VPUTFIELD does not convert the data. To convert data from internal numeric representation to character strings, you must use VPUTtype, where type specifies the data type of the field in an application.

Example

COBOL

      MOVE 1 TO FIELDNUM.
MOVE 10 TO FIELD-LEN.
MOVE "GADGET "TO PART-DES.
CALL "VPUTFIELD" USING COMAREA, FIELDNUM, PART-DES, FIELD-LEN,
DESC-LEN, NEXT-FIELD.

BASIC

      250 F1=1
255 C=10
257 I$="GADGET "
260 CALL VPUTFIELD(C(*),F1,I$,C,A,N)

FORTRAN

      FLDNUM=1
ICOUNT=10
XITEM="GADGET "
CALL VPUTFIELD(COMAREA,FLDNUM,XITEM,ICOUNT,INUM,FLDNXT)

SPL/PASCAL

      INTEGER
FLD'NUM,
COUNT,
ACTUAL'LEN,
NXT'FLD'NUM;
BYTE ARRAY PART'DES(0:9):="GADGET ";
:
FLD'NUM:=1;
COUNT:=10;
VPUTFIELD(COMAREA,FLD'NUM,PART'DES,COUNT,ACTUAL'LEN,NXT'FLD'NUM);

The calls shown above copy a 10-byte value from an application to field number 1 in the data buffer.

VPUTSAVEFIELD

Copies data from an application to the specified save field in memory.

Syntax

VPUTSAVEFIELD {comarea,sfname,sfbuf,buflen,actualen}

Parameters

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 VPUTSAVEFIELD:

cstatus

set to zero.

language

set to the code identifying the programming language of the calling program.

comarealen

set to total number of two-byte words in comarea. Must be at least 70 words in length.

VPUTSAVEFIELD may set the following comarea item:

cstatus

set to nonzero value if call is unsuccessful.

sfname

a character string in the application which contains the name of the save field.

sfbuf

a character string in the application whose contents are copied to the save field in memory.

buflen

a two-byte integer variable which specifies the number of bytes in sfbuf.

actualen

a two-byte integer variable which specifies the number of bytes actually moved to the save field in memory.

Discussion

VPUTSAVEFIELD transfers the contents of the application variable specified by sfbuf to the save field in memory specified by sfname.

If the length of the save field is less than the length specified by buflen, the right most bytes are truncated. Following a successful transfer, actualen is set to the actual number of bytes transferred to the save field in memory.

Note that the contents of the save field as recorded in the forms file is not changed by a call to VPUTSAVEFIELD. Also VPUTSAVEFIELD does not convert the data moved to the save field in memory.

Example

COBOL
CALL "VPUTSAVEFIELD" USING COMAREA SFNAME SFBUF BUFLEN ACTLEN.

SPL
VPUTSAVEFIELD(COMAREA,SFNAME,SFBUF,BUFLEN,ACTLEN);

These calls will transfer the contents of the application buffer SFBUF to the save field in memory specified by SFNAME. If the call is successful ACTLEN will contain the exact number of bytes transferred.

VPUTtype

Copies a numeric value of specified type from an application to a field in the data buffer in memory, converting the value to character set coded external representation.

Syntax

        VPUTtype {comarea,fieldnum,variable}

Parameters

type

The type in VPUTtype indicates that this intrinsic may be specified as:

VPUTINT

converts value to two-byte integer

VPUTDINT

converts value to four-byte integer

VPUTREAL

converts value to four-byte real value

VPUTLONG

converts value to eight-byte long value

*VPUTPACKED

converts packed decimal format to character set coded ASCII; 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.

*VPUTZONED

converts zoned decimal format to character set coded ASCII; 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.

VPUTYYMMDD

converts six-byte character value to YMD, DMY or MYD

For example:

CALL "VPUTINT" USING COMAREA,FIELDNUM,VARIABLE
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 VPUTtype:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

VPUTtype may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

numerrs

May be decremented if new value replaces the value of a field with an error.

fieldnum

Two-byte integer variable containing the field number assigned by FORMSPEC to the field in the data buffer to which the value is copied.

variable

Variable of specified type in an application that contains the value to be converted to USASCII and copied to a field in the data buffer.

Discussion

Depending on how it is specified, this intrinsic converts integer, double, real, long, packed, zoned or yymmdd values to the external representation and copies the converted value to a particular field in the data buffer, right justified. (Note that the exact format depends on the data type of the destination field.) The destination field is identified by the field number assigned by FORMSPEC. The field to which the value is copied may be defined as a numeric field (data type NUM[n], IMPn, or DIG) or as a character field (data type CHAR).

NOTE: If you are using VPUTBUFFER in conjunction with an ARB, you do not need to use VPUTtype. VPUTBUFFER performs all the required conversions on the application data in the buffer.

You can use both VPUTBUFFER with an ARB and VPUTtype calls in the same program: the buffercontrol setting in the comarea that controls ARB processing can be switched on or off for each form.

Note that the field number never changes as long as the field exists. It is not changed when the position of the field in the form is changed, or its length or other characteristics are changed. The field number can only be changed with the batch command, RENUMBER, as described in Section 7. The field number should not be confused the screen order number, which is the position of the field in the data buffer and is based on the field position within the form. Thus, the field number provides a way to locate fields regardless of their position.

If the specified field had an error, VPUTtype clears the field's error flag, and decrements numerrs.

Refer to Table 6-13 “Numeric Type Conversions” under VGETtype for the format of each of the data types that may be converted. Note that COBOL does not have type real or long, and BASIC does not have a double integer data type.

Example

COBOL

     77 FIELD-NUM PIC S9(4) COMP.
77 ITEM PIC S9(4) COMP.
:
MOVE 4 TO FIELD-NUM.
MOVE 25 TO ITEM.
CALL "VPUTINT" USING COMAREA, FIELD-NUM, ITEM.

BASIC

     260 F1=4
263 I=25
265 CALL VPUTINT(C(*),F1,I)

FORTRAN

     FIELD=4
ITEM=25
CALL VPUTINT(COMAREA,FIELD,ITEM)

SPL/PASCAL
INTEGER FIELD,ITEM;
:
FIELD:=4;
ITEM:=25;
VPUTINT(COMAREA,FIELD,ITEM);

The calls shown above convert an integer value of 25 in the application to the external representation and copy it to field 4 in the data buffer in memory.

VPUTWINDOW

Copies a message to the window area of memory.

Syntax

        VPUTWINDOW {comarea,message,length}

Parameters

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 VPUTWINDOW:

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VPUTWINDOW may set the following comarea items:

cstatus

Set to nonzero value if call unsuccessful.

message

Character string containing the message to be copied to the window area of memory.

length

Two-byte integer that specifies the number of bytes in the message. If set to zero, any message in the window is cleared to blanks. The maximum length is 150 bytes, but only 79 or fewer can be printable characters.

Discussion

This intrinsic copies the specified message to the window area of memory for later display. Then, a call to VSHOWFORM can be used to display the message in the window area of the terminal screen, with the window enhanced as indicated by windowenh of comarea. A message copied by VPUTWINDOW overwrites any previous message in the window area, including any message copied by a previous call to VPUTWINDOW or VSETERROR.

If the message is longer than the defined window length, the message is truncated on the right. If shorter, the rest of the window line is cleared.

Note that the forms file may be defined with no window line for error and status messages. In this case, the message is ignored.

Example

COBOL

     MOVE "ENTER ORDERS ON THIS FORM" TO MESSAGE.
MOVE 25 TO MSG-LENGTH.
CALL "VPUTWINDOW" USING COMAREA, MESSAGE, MSG-LENGTH.

BASIC

     310 M1$="ENTER ORDERS ON THIS FORM"
320 L1=25
330 CALL VPUTWINDOW(C(*),M1$,L1)

FORTRAN

     MSG="ENTER ORDERS ON THIS FORM"
LEN=25
CALL VPUTWINDOW(COMAREA,MSG,LEN)

SPL/PASCAL

     BYTE ARRAY MSG(0:24):="ENTER ORDERS ON THIS FORM";
INTEGER LEN;
:
LEN:=25;
VPUTWINDOW(COMAREA,MSG,LEN);

The calls shown above copy the message

ENTER ORDERS ON THIS FORM

to the window area of memory.

VPUTYYYYMMDD

Converts a numeric value representing a date from an application and copies the converted value to a field in the data buffer in memory.

Syntax

VPUTYYYYMMDD {comarea,fieldnum,variable}

Parameters

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 VPUTYYYYMMDD:

cstatus

set to zero.

comarealen

set to total number of two-byte words in comarea. Must be at least 70 words in length.

VGETYYYYMMDD may set the following comarea item:

cstatus

set to nonzero value if call is unsuccessful or requested field has an error.

numerrs

may be decremented if the new value replaces the value of a field with an error.

fieldnum

is a two-byte integer variable which specifies the number assigned to the field by FORMSPEC.

variable

is a character string in the application which contains the value to be converted.

Discussion

VPUTYYYYMMDD converts the contents of the application variable to the date order of the field specified by fieldnum and copies the converted value into the corresponding field in the data buffer, right justified. The application variable should contain a numeric value in YYYYMMDD format. The YYYYMMDD format is an 8-byte ASCII value, for example, 19961225. If errors occur during conversion, cstatus is set to an error code.

Refer to the VPUTtype intrinsic description in the Data Entry and Forms Management System VPLUS Reference Manual for related information.

Example

COBOL
CALL "VPUTYYYYMMDD" USING COMAREA FIELDNUM VARIABLE.

SPL
VPUTYYYYMMDD(COMAREA,FIELDNUM,VARIABLE);

These calls will convert the contents of VARIABLE to a date value and place the converted value in the data buffer corresponding to the field specified by FIELDNUM.

VREADBATCH

Reads contents of current batch record into data buffer in memory.

Syntax

         VREADBATCH {comarea}

Parameters

comarea

Must be comarea name used when the batch file was opened with VOPENBATCH. If not already set, the following comarea items must be set before calling VREADBATCH:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

recnum

Set to the number of the record in the open batch file from which data is to be read (records are numbered from zero).

VREADBATCH may set the following comarea items:

nfname

Set to the name of the form associated with the data read from the batch file (used by VGETNEXTFORM to retrieve this form from forms file).

dbuflen

Set to length of data buffer (in bytes) based on length of data read from batch record.

deleteflag

Set to TRUE (all ones) if delete flag in batch record indicates record is deleted; set to FALSE (all zeros) otherwise.

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

Discussion

Use of this intrinsic is demonstrated by the browse/modify mode of ENTRY. It enables a user to view the data in the batch file. VREADBATCH may also be used to bring the data from a batch file into the data buffer so that it can be retrieved by an application with the VGETBUFFER, VGETFIELD, or VGETtype intrinsics.

To display the data just read onto its associated form, VGETNEXTFORM must be called before the call to VSHOWFORM.

VREADBATCH reads the record (recnum) in the batch file opened by VOPENBATCH. The record is read into memory, where VREADBATCH extracts the batch record control information (refer to the VOPENBATCH description). This information includes the current form name which is moved to nfname, the delete flag which is moved to deleteflag, and the data length in bytes which is moved to dbuflen. The data buffer is not updated if the deleteflag has been set.

In order to use VREADBATCH, the batch file must be on a direct-access device and must be created with fixed-length records, not variable-length records.

Example

COBOL

      CALL "VREADBATCH" USING COMAREA.

BASIC

      175 CALL VREADBATCH(C(*))

FORTRAN

      CALL VREADBATCH(COMAREA)

SPL/PASCAL
VREADBATCH (COMAREA);

The calls shown above read the batch record specified by recnurm update the comarea according to the batch record information stored with the data, and put the data in the data buffer in memory.

VREADFIELDS

Accepts all user input from an open terminal, including data entered by pressing ENTER, or user requests made by pressing a function key. Allows look-ahead form loading.

Syntax

        VREADFIELDS {comarea}

Parameters

comarea

Must be comarea named specified when terminal file was opened with VOPENTERM. If not already set, the following comarea items must be set before calling VREADFIELDS:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

The following comarea items can be set:

lookahead

Set to zero to enable look-ahead form loading or to one to disable look-ahead form loading.

showcontrol

Set to control the touch feature or to affect the display on data capture devices. The particular settings are described below.

VREADFIELDS may set the following comarea values:

numerrs

Set to zero.

lastkey

Set to code for terminal function key pressed by user.

cstatus

Set to nonzero value if call unsuccessful.

Discussion

VREADFIELDS accepts user-entered data when ENTER is pressed. It maps the data into the data buffer in memory. The data is mapped in screen order, from left to right, top to bottom. If there are any display-only fields already in the buffer, the fields read by VREADFIELDS are interspersed among the display-only fields according to the screen order. VREADFIELDS then sets lastkey to zero. Note that the keyboard is locked after the data is read (the subsequent call to VSHOWFORM unlocks the keyboard). If a function key is pressed, VREADFIELDS sets lastkey to the corresponding number: 1 for f1, 2 for f2, and so forth. The screen is not read and data is not transferred when a function key is pressed. It is, however, possible to accomplish this by enabling the AUTOREAD feature. To enable AUTOREAD, a bit must be set in the termoptions position of the comarea. For further information regarding the AUTOREAD feature, consult the Terminal Communications Area section of Appendix G.

Application programs must supply the code to perform each of the functions that can be requested via a function key. The particular function assigned to a key is determined only by how the program processes the key code passed to it by VREADFIELDS (refer to Appendix A for examples of applications using VREADFIELDS).

Normally, there is no time limit for VREADFIELDS, whether the intrinsic is to be terminated by the enter key or by a function key. Timeouts can be enabled in an application by setting bits in the termoptions word of the comarea and specifying a timeout interval in the usertime word of the comarea. For more information regarding user timeouts, consult the Terminal Communications Area section of Appendix G.

For any terminal with touch capability, an application activates the touch feature by setting bit 0 of showcontrol to one. Then, for each time the user touches a field, VREADFIELDS returns lastkey with the field number of the touched field (as a negative number). Refer to Appendix G for the "Supported Terminal Features" list.

For the data capture devices, VREADFIELDS, not VSHOWFORM, displays a form one field at a time and reads entered data, also one field at a time. Editing is performed after data for all the fields in the form has been read. VREADFIELDS sets lastkey as follows for these terminals: -1 is the ATTENTION key, 0 is the ENTER key, 1 is the "A" key, 2 is the "B" key...and 26 is the key. If a function key is pressed when entering data on the data capture devices, VREADFIELDS returns to the calling program and does not display any remaining fields.

Bits 12 and 11 of the comarea item showcontrol affect form display on the data capture devices. These bits can be set as follows:

bit 12 = 0

Stop after displaying a form without fields.

1

Do not stop after displaying a form without fields.

11 = 0

Do not put a right closing bracket (]) on all input fields.

1

Put a right closing bracket (]) on all input fields.

A form without fields can be used to display a message to a user. If bit 12 is zero, this type of form is frozen until ENTER or a function key is pressed so that the user has time to read the message. If bit 11 is one, a right bracket is displayed as a terminator on all input fields.

VREADFIELDS may also invoke look-ahead form loading for terminals with local form storage using the comarea item lookahead. If point-to-point data communications is being used, the next form (as defined in the forms file) is loaded into the terminal's local form storage memory while the user is typing in data) before ENTER is pressed. If multipoint or X.25 data communications is being used, the next form is loaded after the data has been read, after ENTER is pressed. If there is no room in local form storage for the next form, or if there are no available entries in the form storage directory (set with formstoresize prior to VOPENTERM and VOPENFORMF), the least recently used form could be purged from local form storage. Look-ahead form loading does not load multiple family members. If a family member of the next form is already in local form storage, this family member is changed into the required form when it is displayed. (Refer to Section 4 for more information on Local Form Storage.)

If the next form does not load successfully, no error is returned. The next form is simply displayed by VSHOWFORM.

Example

COBOL

     CALL "VREADFIELDS" USING COMAREA.

BASIC

     130 CALL VREADFIELDS(C(*))

FORTRAN

     CALL VREADFIELDS(COMAREA)

SPL/PASCAL

     VREADFIELDS(COMAREA);

Each of the following calls accepts user input from the terminal, transfers any data to the data buffer, and sets lastkey.

VSETERROR

Sets the error flag of a specified field and increments numerrs. If this is the first field (in screen order) with an error, it copies a message to the window area of memory for later display.

Syntax

        VSETERROR {comarea,fieldnum,message,msglen}

Parameters

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 VSETERROR:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VSETERROR may set the following comarea items:

numerrs

Contains number of fields in form with errors; incremented by VSETERROR.

cstatus

Set to nonzero value if call unsuccessful.

fieldnum

Two-byte integer variable containing the field number or screen order number of the data field to be flagged for error. If it is the screen order number, it must be a negative number representing the position of the field on the form.

message

Character string containing an error message to be copied to the window area of memory for subsequent display by VSHOWFORM.

length

Two-byte integer containing the length in bytes of the message parameter. If length is set to -1, the current content of the window is not changed. If length is set to zero, the current content of the window is cleared to blanks.

Discussion

This intrinsic can be called by any program that wants to perform its own edits, either in addition to, or instead of VFIELDEDITS. VSETERROR sets the error flag associated with the specified field. If this is the first time this field has been diagnosed as having an error, VSETERROR increments numerrs; otherwise, it does not change numerrs. Thus, if a field has an error detected by a prior call to VFIELDEDITS, a call to VSETERROR for that field does not increment numerrs. However, if the touch feature is enabled, VSETERROR toggles the error flag for a specified field to clear, if it was already set, and decrements numerrs. Refer to "Coding the Touch Feature" in Appendix E.

If this is the first field in the form (in screen order) that has an error, the specified message is copied to the window area of memory for later display. If you do not want to change the current contents of the window, set the length parameter to -1. To clear a message, set length to zero.

Note that the field number identifies a field regardless of its position in the form. Thus, field "1" could be the third field in screen order counting from left to right, top to bottom. Using the field order number is preferable because if the fields in a form are rearranged, no modification to an application is necessary.

Example

COBOL

      DATA DIVISION.
77 FLDNUM PIC 9(4) COMP.
77 MESSAGE PIC X(80).
77 MLENGTH PIC S9(4) COMP.
:
PROCEDURE DIVISION.
MOVE 3 TO FIELDNUM.
MOVE 22 TO MLENGTH.
MOVE "THIS FIELD IS REQUIRED" TO MESSAGE.
CALL "VSETERROR" USING COMAREA, FLDNUM, MESSAGE, MLENGTH.

BASIC

          220 F1=3
225 L1=22
230 M$="THIS FIELD IS REQUIRED"
250 CALL VSETERROR(C(*),F1,M$,L1)

FORTRAN

          FF=3
ML=22
MSG="THIS FIELD IS REQUIRED"
CALL VSETERROR(COMAREA,FF,MSG,ML)

SPL/PASCAL

          INTEGER FF,ML;
BYTE ARRAY MESSAGE(0:21);="THIS FIELD IS REQUIRED";
:
FF:=3;
ML:=22;
VSETERROR(COMAREA,FF,MESSAGE,ML);

The examples above set error flags for field number "3" in the currently open form, and set up the message "THIS FIELD IS REQUIRED" to be displayed if no value is entered in the field and this is the first field (in screen order) in which an error is detected.

The following examples show how VSETERROR can be used to set error flags for a field in error without writing a message to the window.

COBOL

   MOVE 3 TO FIELDNUM.
MOVE -1 TO MLENGTH.
CALL "VSETERROR" USING COM1, FIELDNUM, MESSAGE, MLENGTH.

BASIC

   220 F1=3
230 L1=-1
CALL VSETERROR(C(*),F1,M$,L1)

FORTRAN

   FF=3
ML=-1
CALL VSETERROR(COM1,FF,MSG,ML)

SPL/PASCAL

   FIELD:=3;
LEN:=-1;
VSETERROR(COM1,FIELD,MESSAGE,LEN);

VSETKEYLABEL

Allows for temporarily setting, programmatically, a new label for a function key.

Syntax

         VSETKEYLABEL {comarea,formorglob,keynum,label}

Parameters

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 VSETKEYLABEL:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VSETKEYLABEL may set the following comarea items:

cstatus

Set to nonzero value if call is unsuccessful.

formorglob

Integer specifying which type of label is to be temporarily set.

  • 0 - Set global label.

  • 1 - Set current form label.

keynum

Integer from 1 to 8 corresponding to function key to be set.

label

A byte array containing the text for the label; must be 16 bytes long.

Discussion

VSETKEYLABEL is only a temporary setting of a new label for an individual function key. Use of this intrinsic does not change the label definition made in FORMSPEC. Note only one function key can be set with this intrinsic. The labeloption must be set to one prior to VOPENFORMF.

The temporary label is displayed after the next call to VSHOWFORM. If the temporary label is global, it remains active until the forms file is closed or it is replaced by a new global label. If the temporary label is for the current form only, it is replaced when the next form is retrieved or when a new current form label is set.

If no global or current form labels have been defined with FORMSPEC or no labels have been set with VSETKEYLABELS, the key label buffers are cleared before the label being defined with this intrinsic is set.

Example

COBOL

     77 FORM-OR-GLOB    PIC S9(4)COMP.
77 KEY-NUM PIC S9(4)COMP.
77 KEY-LABEL PIC X(16).
:
MOVE 1 TO FORM-OR-GLOB.
MOVE 1 TO KEY-NUM.
MOVE "LABEL 1 " TO KEY-LABEL.
CALL "VSETKEYLABEL" USING COMAREA, FORM-OR-GLOB, KEY-NUM, KEY-LABEL.

BASIC

     10 INTEGER F,N
20 DIM L$[16]
30 F=1
40 N=2
50 L$="LABEL 1 "
60 CALL VSETKEYLABEL(C[*],F,N,L$)

FORTRAN

     INTEGER FORMORGLOB,KEYNUM
CHARACTER*16 LABEL
FORMORGLOB=1
LABEL="LABEL 1 "
CALL VSETKEYLABEL(COMAREA,FORMORGLOB,KEYNUM,LABEL)

SPL/PASCAL

     INTEGER
FORM'OR'GLOB,
KEY'NUM;
BYTE ARRAY
KEY'LABEL(0:15);
:
FORM'OR'GLOB:=1;
KEY'NUM:=1;
MOVE KEY'LABEL:="LABEL 1 ";
VSETKEYLABEL(COMAREA,FORM'OR'GLOB,KEY'NUM,KEY'LABEL);

VSETKEYLABELS

Allows for temporarily setting, programmatically, labels for function keys.

Syntax

        VSETKEYLABELS {comarea,formrglob,numoflabels,labels}

Parameters

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 VSETKEYLABELS:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VSETKEYLABELS may set the following comarea items:

cstatus

Set to nonzero value if call is unsuccessful.

formorglob

Integer specifying which type of labels are to be temporarily replaced.

  • 0 - Replace global labels.

  • 1 - Replace current form labels.

numoflabels

Integer from 0 through 8 indicating how many labels are to be temporarily set, where 0 indicates that the labels defined in FORMSPEC should be used.

labels

A byte array in which the labels are defined. The length of the array must be at least numoflabels * 16.

Discussion

VSETKEYLABELS is only a temporary setting of new labels for the function keys. Use of it does not change the label definitions made in FORMSPEC. The labeloption must be set to one prior to VOPENFORMF.

The temporary labels are displayed after the next call to VSHOWFORM. If the temporary labels are global, they remain active until the forms file is closed or replaced by new global labels. If the temporary labels are current form labels, they are replaced when the next form is retrieved or when new current form labels are set.

If no global or current form labels have been defined with FORMSPEC or no labels have been set with a prior call to VSETKEYLABELS, the key label buffers are cleared before the labels currently being defined are set.

Example

COBOL

     77 FORM-OR-GLOB     PIC S9(4)COMP.
77 NUM-OF-LABELS PIC S9(4)COMP.
77 KEY-LABELS PIC X(32).
:
MOVE 1 TO FORM-OR-GLOB.
MOVE 2 TO NUM-OF-LABELS.
MOVE "LABEL 1 LABEL 2 " TO KEY-LABELS.
CALL "VSETKEYLABELS" USING COMAREA,FORM-OR-GLOB,NUM-OF-LABELS,KEY-LABELS.

BASIC

     10 INTEGER F,N
20 DIM L$[32]
30 F=1
40 N=2
50 L$="LABEL 1 LABEL 2 "
60 CALL VSETKEYLABELS(C[*],F,N,L$)

FORTRAN

     INTEGER FORMORGLOB,NUMLABELS
CHARACTER*32 LABELS
FORMORGLOB=1
NUMLABELS=2
LABELS="LABEL 1 LABEL 2 "
CALL VSETKEYLABELS(COMAREA,FORMORGLOB,NUMLABELS,LABELS)

SPL/PASCAL

     INTEGER
FORM'OR'GLOB,
NUM'OF'LABELS;
BYTE ARRAY
LABELS(0:31);
:
FORM'OR'GLOB:=1;
NUM'OF'LABELS:=2;
MOVE LABELS:="LABEL 1 LABEL 2 ";
VSETKEYLABELS(COMAREA'FORM'OR'GLOB,NUM'OF'LABELS,LABELS);

VSETLANG

The VSETLANG intrinsic specifies the native language to be used with an international forms file. For more information on Native Language Support, see Section 8.

Syntax

        VSETLANG {comarea,langnum,errorcode}

Parameters

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 VSETLANG:

comarealen

Set to the total number of two-byte words in comarea.

VSETLANG may set the following comarea items:

cstatus

Set to nonzero value if call is unsuccessful.

langnum

A two-byte integer, passed by value, containing the native language ID number of the forms file language to be used by VPLUS.

errorcode

Two-byte integer to which the error code is returned.

Discussion

This intrinsic sets the native language to be used by VPLUS at run time for an international forms file. The forms file must be opened before calling VSETLANG. Otherwise, cstatus returns a nonzero value.

If VSETLANG is called to set the native language ID for a language-dependent or unlocalized forms file, an error code of -1 will be returned to errorcode. For international forms files, both cstatus and errorcode return a value of zero and the forms file is processed with the native language ID specified in langnum.

Example

COBOL

     CALL "VSETLANG" USING COMAREA,\LANGNUM\,ERRORCODE

BASIC Pass by value parameters not supported.

FORTRAN

     CALL VSETLANG (COMAREA,LANGNUM,ERRORCODE)

SPL/PASCAL

     VSETLANG(COMAREA,LANGNUM,ERRORCODE)

VSHOWFORM

Displays on the terminal screen the current form from local form storage or from the form definition buffer, any data in the data buffer, and any messages from the window buffer. Displays any labels from the key label buffer.

Syntax

        VSHOWFORM {comarea}

Parameters

comarea

Must be the comarea name specified when the terminal file was opened with VOPENTERM. If not already set, the following comarea items must be set before calling VSHOWFORM:

cstatus

Set to zero

comarealen

Set to total number of two-byte words in comarea.

windowenh

Set to window enhancement code; may be set before call to code for nondefault enhancement; otherwise, set by VOPENFORMF to default enhancement specified in forms file. If set to zero, window is not enhanced. (Refer to windowenh discussion under "Communication Area" earlier in this section.)

The following comarea item can be set:

showcontrol

Set to change VSHOWFORM control options. The particular settings are described below.

VSHOWFORM may set the following comarea values:

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

(Note that showcontrol is not cleared by VSHOWFORM.)

Discussion

VSHOWFORM displays, on an open terminal screen, the form currently stored as a form image in the terminal's local form storage or in the form definition area of memory. Any enhancements specified for the form are used for the display. Data currently in the data buffer in memory is moved to the appropriate fields of the displayed form. Any message in the window buffer of memory is displayed in the line of the form selected as the status line. Also, any current form or global function key labels in the key label buffer are displayed.

Performance Optimization

In order to optimize VSHOWFORM performance, only changed information is written to the terminal. Thus, if the window has not been changed by VPUTWINDOW or VSETERROR since the last execution of VSHOWFORM, or if the current form is being repeated in place, these areas are not rewritten. Also, when a form is repeating in place, only the changed values in the data buffer area of memory are written by VSHOWFORM. This will be sufficient for most applications; however, these three optimizations (form, data, window) can be overridden by setting the comarea item showcontrol as follows:

bit 15 = 1

Force form to be written to the terminal screen.

14 = 1

Force data and field enhancements to be written to the terminal screen.

13 = 1

Force window line to be written to the terminal screen.

Depending on the bits set, VSHOWFORM writes a form or data or the window to the terminal whether or not it has changed. Anything that has changed is always written to the terminal regardless of showcontrol. Any combination of these bits may be set. For example, if you want to force a write of all data:

showcontrol = octal 2

Or, if you want to force the window to be written:

showcontrol = octal 4

Display and Local Form Storage

Prior to display on terminals with local form storage, the form can be loaded into the terminal with any of the following methods:

  • by a call to VLOADFORMS,

  • by the previous call to VREADFIELDS if look-ahead form loading is enabled, or

  • by VSHOWFORM if preload is enabled.

A prior call to VGETNEXTFORM reads the form into the form definition area of memory prior to display by VSHOWFORM. The form definition includes the form image, any field editing specifications and all enhancements.

The field enhancements are specified with the form definition. If a field has an error, VSHOWFORM changes its enhancement to the error enhancement defined for the form by FORMSPEC.

The data buffer may contain data as a result of initialization by VINITFORM, retrieval of user-entered data by VREADFIELDS, data formatting or movement caused by editing specified with each field and executed by VINITFORM, VFIELDEDITS, or VFINISHFORM. Data may also be transferred directly to the data buffer, either from an application with VPUTBUFFER or VPUTtype, or from a batch file with VREADBATCH.

The window contains any message set by VSETERROR or VPUTWINDOW.

Controlling the Keyboard

As soon as the form is displayed, VSHOWFORM normally enables the keyboard so the user can enter data. The next call is usually to VREADFIELDS, which locks the keyboard after the entered data is read. In case of consecutive calls to VSHOWFORM, the following showcontrol bit can be set:

bit 10 = 0

Enable the keyboard.

1

Do not enable the keyboard.

The scenario is as follows:

  • the last VREADFIELDS call locked the keyboard,

  • for each of a series of consecutive calls to VSHOWFORM; set bit 10 of showcontrol to one so the keyboard is not enabled,

  • for the last of the consecutive calls to VSHOWFORM, set bit 10 to zero to enable the keyboard.

This ensures that keystrokes do not change a form while it is being displayed. Consecutive calls to VSHOWFORM could be used to display a form with no fields, append another form to it, and display this second form without doing a read in between.

Controlling Preload of Forms

On terminals with local form storage, VSHOWFORM first determines if the current form is already in the terminal. If the form is in local storage, it is displayed from local storage. If the form is not in local storage, it is preloaded into the terminal from the form definition area of memory depending on showcontrol, which can be set as follows:

bit 9 = 0

Do not preload the form.

1

Preload the form.

If bit 9 is zero, the form is written directly from the form definition area of memory to the terminal screen. If bit 9 is one, the form is preloaded into local storage and then displayed from local storage. One or more forms could be purged from local storage if there is not room for the form that is being loaded. Note that purging could occur even when lookahead is set to one.

Controlling the Touch Feature

On terminals with the touch feature, touch can be enabled or disabled with showcontrol, which can be set as follows:

bit 0 = 0

Do not enable the touch feature.

1

Enable the touch feature.

Controlling the Bell

By default (termoptions bit 15 is set to zero), VSHOWFORM sounds the bell if neither the screen nor the window line have been redisplayed. The bell can be suppressed in all cases by setting the termoptions bit to one.

Example

COBOL

     CALL "VSHOWFORM" USING COMAREA.

BASIC

     120 CALL VSHOWFORM(C(*))

FORTRAN

     CALL VSHOWFORM(COMAREA)

SPL/PASCAL

     VSHOWFORM (COMAREA);

The calls shown above display a form with optional data and enhancements on the terminal screen opened with the comarea, COM 1.

VTURNOFF

The VTURNOFF intrinsic turns off VPLUS block mode and enables character mode access without disturbing the terminal screen. The syntax and parameter descriptions for this intrinsic are provided below.

Syntax

   VTURNOFF {COMAREA}

Parameters

COMAREA

Must be COMAREA name specified when the forms file was opened with VOPENTERM. If not already set, the following COMAREA items must be set before calling VTURNOFF:

CSTATUS

Set to zero.

COMAREALEN

Set to total number of 2-byte words in COMAREA.

VTURNOFF may set the following COMAREA fields:

CSTATUS

Set to nonzero value if call is unsuccessful or if field's error flag is set.

FILERRNUM

Set to file error code if MPE file error.

VTURNOFF is used for momentarily switching from VPLUS block mode to character mode. This procedure is designed for use after a terminal has been previously opened by VOPENTERM or after a VTURNON.VTURNOFF reconfigures the terminal and driver for character mode operations without disturbing the screen image on the terminal. The following operations normally performed in VCLOSETERM are not performed in VTURNOFF:

  • Clear local form storage

  • Enable the USER/SYSTEM keys

  • Disable touch reporting, delete touch fields

  • Clear screen

  • Unlock keyboard

  • Close terminal file

Note that VTURNOFF does not close the terminal file. To close the file and completely reset the driver and the terminal, VCLOSETERM must be used.The following examples illustrate a call to VTURNOFF:

COBOL:

  CALL "VTURNOFF" USING COMAREA. 

BASIC:

  200 CALL VTURNOFF(C(*))

FORTRAN:

   CALL VTURNOFF(COMAREA)

SPL:

   VTURNOFF(COMAREA);

PASCAL:

   VTURNOFF(COMAREA);

VTURNON

The VTURNON intrinsic turns on VPLUS block mode without disturbing the terminal screen. The syntax and parameter descriptions for this intrinsic are provided below.

Syntax

   VTURNON {COMAREA,TERMFILE}

Parameters

COMAREA

The COMAREA name must be unique for each open forms file. The COMAREA must be the same COMAREA used in VOPENTERM. The following COMAREA items must be set before the call, if not already set:

CSTATUS

Set to zero.

LANGUAGE

Set to code that identifies the programming language of the calling program.

COMAREALEN

Set to total number of 2-byte words in COMAREA.

VTURNON may set the following COMAREA fields:

CSTATUS

Set to nonzero value if call is unsuccessful or if field's error flag is set.

FILERRNUM

Set to file error code if MPE file error.

FILEN

Set to MPE file number of terminal.

IDENTIFIER

Set to appropriate VPLUS/V terminal ID.

LAB'INFO

Set to appropriate number and length of labels.

TERMFILE

Must be the same terminal file name used in VOPENTERM.

VTURNON is normally used in an application when the terminal is already opened by VOPENTERM, and VTURNOFF was called to switch out of VPLUS block mode. VTURNON switches the application back to VPLUS block mode without disturbing the image on the terminal screen.

VTURNON reconfigures the terminal and the driver without performing the following operations which are normally performed by VOPENTERM:

  • Initialize local form storage

  • Clear screen

  • Enable the USER function keys

  • Disable or enable the USER/SYSTEM key, as specified in the SHOWCONTROL word

Unlike VOPENTERM, VTURNON will not ask you to press the BLOCK MODE key, if you are using an HP 2640B or HP 2644 terminal when the terminal is not in block mode.

The following examples illustrate a call to VTURNON using common programming languages:

COBOL:

   CALL "VTURNON" USING COMAREA, T1.

BASIC:

   90 T1$=" "
   100 CALL VTURNON(C(*),T1$)

FORTRAN:

   T1="  "
   VTURNON(COMAREA,T1);

SPL:

   MOVE T1:="  ";
   VTURNON(COMAREA,T1);

Pascal:

   T1:=' ';
   VUTURNON(COMAREA,T1);

VUNLOADFORM

Unloads the specified form from local form storage memory.

Syntax

       VUNLOADFORM {comarea,whichform}

Parameters

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 VUNLOADFORM:

cstatus

Set to zero.

language

Set to the code identifying the programming language of the calling program.

comarealen

Set to total number of two-byte words in comarea.

VUNLOADFORM may set the following comarea values:

cstatus

Set to nonzero value if call unsuccessful.

whichform

The name of the form to be removed from local form storage. Each name can be up to 15 characters and is stored in a 16-byte character array with a one byte filler that is not part of the name.

Discussion

This intrinsic is used on terminals having local form storage. VUNLOADFORM purges the form named by the whichform parameter from terminal local form storage memory. Note that the terminal keyboard may be locked briefly while VUNLOADFORM verifies whether or not the form was purged. In case keys are pressed during this time, the terminal beeps to indicate that the keystrokes and/or entered data are lost. You can avoid this by not calling VUNLOADFORM between calls to VSHOWFORM and VREADFIELDS.

Example

COBOL

     77 WHICH-FORM       PIC X(16).
:
MOVE "FORMA " TO WHICH-FORM.
CALL "VUNLOADFORM" USING COMAREA, WHICH-FORM.

BASIC

      10 DIM W$[16]
20 W$="FORMA "
100 CALL VUNLOADFROM(C[*],W$)

FORTRAN

     CHARACTER*16 WFORM
WFROM="FORMA "
CALL VUNLOADFORM(COMAREA,WFORM)

SPL/PASCAL

     BYTE ARRAY WHICH'FORM(0:15);
:
WHICH'FORM:="FORMA ";
VUNLOADFORM(COMAREA,WHICH'FORM);

VWRITEBATCH

Writes a record to the batch file from the data buffer in memory, or deletes a record from the batch file

Syntax

        VWRITEBATCH {comarea}

Parameters

comarea

Must be comarea name specified when the batch file was opened with VOPENBATCH. If not already set, the following comarea items must be set before calling VWRITEBATCH:

cstatus

Set to zero.

comarealen

Set to total number of two-byte words in comarea.

recnum

Set to record number in batch file to which data is to be written (record numbers start with zero). The recnum is initialized to zero by VOPENBATCH (or to the next sequential record number if the file is an existing file).

deleteflag

Set to TRUE (all ones) if record is to be deleted.

(The cfname and dbuflen should be set by a prior call to VGETNEXTFORM.)

VWRITEBATCH may set the following comarea values:

cstatus

Set to nonzero value if call unsuccessful.

filerrnum

Set to file error code if MPE file error.

numrecs

Incremented each time a new record is written; decremented if record is deleted.

Discussion

VWRITEBATCH writes the contents of the data buffer to the record specified by recnum in an open batch file. (The recnum must be maintained by the calling program.) VWRITEBATCH writes the following information to the batch record:

  • Contents of the data buffer

  • Batch record control information (from comarea):

    deleteflag

    TRUE if record is deleted.

    cfname

    Name of the form associated with this data.

    dbuflen

    Length (in characters) of the data buffer.

(Refer to "Record Format" in the VOPENBATCH description for a diagram of the batch record.)

VWRITEBATCH may be used in both the data collection and modify modes.

Data Collection Mode

The data in the data buffer is entered on a particular form displayed at a terminal and then read into the data buffer by VREADFIELDS.

VWRITEBATCH can then be called to write the data buffer and the record control information to the batch record specified by recnum.

Modify Mode

When data is modified, an existing batch file record is rewritten. The calling program must set recnum to the record number of this record.

To mark a batch record as deleted, the deleteflag must be set to TRUE (all ones) by an application. Then a call to VWRITEBATCH sets a corresponding flag in the batch record to mark the record as deleted. Since a deleted record still exists in the batch file, it can be viewed through FCOPY or a user-written intrinsic.

In ENTRY, a function key pressed by the user not only determines which record is to be viewed, but also specifies which record is to be deleted.

Example

COBOL

      CALL "VWRITEBATCH" USING COMAREA.

BASIC

      165 CALL VWRITEBATCH(C(*))

FORTRAN

      CALL VWRITEBATCH(COMAREA)

SPL/PASCAL

      VWRITEBATCH(COMAREA);

The calls shown above write the contents of the data buffer to the batch record identified by recnum. Assume the following data is in the data buffer and that it was entered on form ORDENT. (Note that the data entered on separate fields of a form is concatenated in the data buffer, with no separators.)

Assume the comarea is set as follows:

  • recnum = 5

  • cfname = ORDENT

  • dbuflen = 37

In addition, assume the batch file opened by VOPENBATCH has fixed-length records, 80 bytes long. The call to VWRITEBATCH writes the following record as the sixth record in the batch file:

Feedback to webmaster