HPlogo Communicator 3000 MPE/iX Release 6.0 (Platform Software Release C.60.00): HP 3000 MPE/iX Computer Systems > Chapter 10 Technical Articles

Year 2000 and Other Enhancements in VPLUS

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

by Kumar KN and Rajesh Channabasavaiah
Commercial Systems Division

Introduction

This article provides information on the following VPLUS enhancements available in version B.06.07.

  • Turn-of-century enhancement

  • Ability to define default Field Type and Data Type for a Form

  • Ability to define more than 52 single character fields per Form

  • New intrinsics to get and set Save Field values programmatically

  • Ability to Renumber a Form with Interactive FORMSPEC

A description of these features follows.

Turn-of-Century Enhancement

VPLUS version B.06.07 contains enhancements to handle Year 2000 and beyond in applications. These enhancements can be grouped into three segments as follows:

  • Intrinsic enhancements

  • FORMSPEC enhancements

  • Processing enhancements

Intrinsic Enhancements

Two new intrinsics have been added to VPLUS to handle dates in the next century. These are VGETYYYYMMDD and VPUTYYYYMMDD. These intrinsics are similar in structure and function to the existing intrinsics VGETYYMMDD and VPUTYYMMDD respectively. The difference is that the date values handled by the new intrinsics contain 4-digit year components.

Intrinsic 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.

Intrinsic 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.

FORMSPEC Enhancements

FORMSPEC Application Ready Buffer (ARB) processing has been enhanced with the addition of a new ARB data type. This data type can be specified on the DTC Menu for Data Type Conversions from Screen Type to Application Type. The new ARB Type is YYYYMD and is defined as a 8-byte ASCII field containing a date value in YMD order with no separators. Also the year component in the date value has 4 digits. Note that FORMSPEC will ensure a length of 8 for the data type YYYYMD in the ARB. In essence, the value is of the form YYYYMMDD (8 bytes) even though the Type designator on the DTC Menu has been abbreviated to YYYYMD.

For more details on ARB Types and how to use them, refer to the "ARB Data Types" section in the Data Entry and Forms Management System VPLUS Reference Manual.

Processing Enhancements

Date processing in VPLUS has been enhanced to handle date values with 4-digit year components. Specifically, the following additions have been made.

Date output will be formatted with 4-digit years if the target field is wide enough to receive the date, and the user requests this action. Examples of such output include the SET statement in FORMSPEC. The target field should be at least 10 characters in length to have a 4-digit year output.

VPLUS, by default, will format date output with 2-digit years. To change the behavior as described above, define a JCW called VSETNEXTCENTURY and set bit 15 to 1 (bits are numbered from 0 through 15). It should be noted that this option will be active for fields wide enough to hold the 4-digit year date. For other fields, 2-digit years will be used.

Existing 2-digit years can be interpreted differently to handle dates in the next century. Currently VPLUS handles year components 00-99 as 1900-1999. This scheme of interpretation can be changed. In the new scheme, 00-49 is interpreted as 2000-2049 and 50-99 is interpreted as 1950-1999. This interpretation will be valid through all processing done by VPLUS. For example, this scheme will allow the user to enter 02/29/00 (MDY order) in an existing application and have it processed correctly.

To invoke the above method of date interpretation, define a JCW called VSETNEXTCENTURY and set bit 14 to 1. Note that this method is used for processing only 2-digit year dates and not 4-digit year dates. Note also that the display of 2-digit year dates is not affected by this enhancement. This means that 12/11/10 (MDY order) can refer to 1910 in one application and 2010 in another application.

NOTE: When defining the JCW VSETNEXTCENTURY, set all unused bits to 0.

Programmable Defaults for Field and Data Types in FORMSPEC

FORMSPEC version B.06.07 has been enhanced to provide the capability to set the default Field Type and Data Type of a form. This capability can be used to reduce the time taken to complete the design of a new form.

Two new fields for user input have been added to the Form Menu screen of FORMSPEC. One is for the default Field Type, and the other is for the default Data Type.

On the Form Menu, the user typically specifies the name of the form and other characteristics of the form. In addition now, the user can specify the default Field Type and Data Type for the form. For a list of the allowable values for the Field Type and Data Type, refer to the Data Entry and Forms Management System VPLUS Reference Manual. All fields created newly for the form will have the Field Type and Data Type set to the default values supplied on the Form Menu.

Notes

  • The Field Type and Data Type values supplied on the Form Menu are applicable only to fields created for the form thereafter. This means that if these default values are changed for an existing form, the types of the existing fields are not changed. For a new form, the default values apply to all the fields created for the form.

  • Cloned forms have their screen already designed; hence, the values on the Form Menu do not apply to such forms.

  • The Field Type and Data Type can be specified independently. This means that either, or both, fields on the Form Menu can be blank.

    • If the Field Type is blank, all newly created fields for the form will have a Field Type of "O."

    • If the Data Type is blank, all newly created fields for the form will have a Data Type of "CHAR."

Ability to Define More than 52 Single Character Fields per Form

This enhancement allows more than 52 single character fields to be defined for a Form. Currently the field tag which is defined for a field at screen design (creation) time should begin with an alphabetic character. This enhancement will allow several other characters to be used for the field tag, thus increasing the number of single character fields that can be defined for a Form.

The following are the other characters which can be used for the field tag (defined at screen creation time):

Digits

0,1,2,3,4,5,6,7,8,9

Specials

@,#,$,%,&,*,-,+,<,>,/,\,!,|,=,?,;,_

Field Menu Initialization

In the case where one of the characters listed above (a Digit or a Special) is used in a single character field, the Field Name will be blanked out when the Field Menu is invoked for the field the first time. The user should input a new name for the field in this case. With this enhancement, a maximum of 80 single character fields can be defined for a Form.

Compatibility issues

Forms created with previous versions of FORMSPEC can be used with this version without any modifications.

Forms created with this version of FORMSPEC can be used with existing applications without any modifications.

Forms created with this version of FORMSPEC can be used with previous versions of FORMSPEC. However, some extra characters may appear near the bottom of the Form Menu screen which should be ignored. These extraneous characters appear only once, the first time the Form Menu is invoked for the form, and they do not affect the functionality in any way.

New Intrinsics to Get and Set Save Field Values

Two new intrinsics have been added to VPLUS to enable applications to access Save Fields. They are VGETSAVEFIELD and VPUTSAVEFIELD. The values of Save Fields can be accessed/changed using the new intrinsics. It is important to note that the values of the Save Fields cannot be modified in the forms file by these intrinsics.

Intrinsic 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 bytes to the right 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.

Intrinsic 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

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

sfbuf

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

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 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 bytes to the right 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.

Renumbering a Form with Interactive FORMSPEC

FORMSPEC provides an option to renumber forms interactively. A new command has been added to the Interactive FORMSPEC to renumber forms. This command is invoked by selecting option "N" on the Main Menu. The form to be renumbered should be specified in the field next to the keyword "N". (This field is the same as where you would specify a form when also selecting the "D" option.) This option is equivalent to the RENUMBER command in batch mode FORMSPEC.

Feedback to webmaster