HPlogo HP Data Entry and Forms Management System (VPLUS) Reference Manual: HP 3000 MPE/iX Computer Systems > Chapter 5 Reformatting Specifications

Relation of Forms to Output Records

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Every record in a batch file consists of data entered on a single form. It may be that the data on one form represents a logical group of information. However, the data from a sequence of forms may make up such a logical grouping, or the data entered on one form may make several logical groupings. The reformatter allows you to rearrange the entered data into output records with different groupings.

Before running REFSPEC to set up your reformat file, it is important to understand the relations between the forms (and the data entered on the forms) and the output records generated by the reformatter. The forms to be reformatted are identified in the input forms sequence of the reformat file; the output records are defined in the associated output record definitions.

Input Forms Sequence

Each input forms sequence lists the form or forms on which the data to be reformatted was entered.

In order to generate the output file from the reformatting specifications, REFORMAT reads each batch record in turn. Associated with each record is the form on which the data was entered. For the first batch record, REFORMAT searches the input forms sequences in the reformat file for a matching "reformat identifier". This identifier is the name of the first form in each in put forms sequence, and must be unique in the reformat file. If a matching reformat identifier is not found, the batch record is skipped.

Other form names may follow the reformat identifier in the same input forms sequence. These form names need not be unique. If a sequence of forms is specified, the batch records following the record that matches the reformat identifier must exactly match the form names in the input forms sequence. If they do not, the batch record is skipped, and the next batch record is checked against all reformat identifiers in the reformat file. Some rules to remember:

  • Every batch file record contains data entered on a single form.

  • The form name on which the data was entered is stored in the batch record with the data.

  • Records in the batch file are processed sequentially starting with the first record and continuing through to the end.

  • The first form name in each input forms sequence is the reformat identifier, and must be unique.

  • In order to be reformatted, the form name of a batch record must match one of the reformat identifiers or be in a sequence following a form that matches a reform at identifier.

  • Form names in an input forms sequence following the reformat identifier can appear in other input forms sequences as reformat identifiers or as part of a sequence following the reformat identifier.

  • If more than one form is named in an input forms sequence, the sequence of batch records starting with the reformat identifier must exactly match the sequence of forms.

Output Record Definition

The output record definition determines how information from batch file records is stored in the output file. Any field in the batch file that is to be written to an output record must be uniquely identified. The sequence of the output field names in the output record definition determines the order in which fields are written to the output record. Fields from the batch file may thus be reordered, or repeated, or omitted from the output record.

Constants, in the form of literals, system constants, or the numeric equivalent of USASCII characters, can be interspersed freely between fields or portions of fields in the output record definition.

The output record definition also determines where each output record begins. The designer can mark one or more fields (or constants) as the starting point of a record. If no field is so marked in an output record definition, then the first field in the definition is appended to the last field in the previous definition as part of the same record. Thus a batch record can be divided into several output records, or be made part of a larger record.

Note that you can specify a fixed record length, or a maximum variable record length, for all output records through the Globals Menu. REFSPEC does not allow the designer to specify a record in any one output record definition that is longer than this maximum length; however, it does not check the length of a record formed from several output record definitions. Some rules to remember:

  • A unique output field name must be assigned to any batch field to be written to the output file. (Usually, the input field name is unique and can be used as the output field name.)

  • Batch fields are written to the output file in order of the output field names.

  • Only those fields specified in an output record definition are written to the output file.

  • A particular batch field can be specified many times in a single output record definition as long as each occurrence is given a unique output field name.

  • A start-of-record marker in an output record definition determines the start of an output record.

  • A start-of-record marker can be associated with any field or constant in an output record definition.

  • If no start-of-record marker is included in an output record definition, the first field of this definition follows the last field of the preceding definition when it is written to the output file.

Field Specifications

An Output Field Menu is issued for each field named in the preceding output record definition. The designer can reformat the output field, or leave the field as it was written to the batch file.

The following set of examples illustrates some ways in which the data from a batch file can be reorganized in an output file.

Combining Data from Several Forms

Suppose data is entered on forms A, B, and C. The reformat file shown in Figure 5-3 “Combining Data from 3 Forms into 1 Output Record” processes these records in sequence and writes them to one output record.

Figure 5-3 Combining Data from 3 Forms into 1 Output Record

Combining Data from 3 Forms into 1 Output Record

Data from the batch file illustrated in Figure 5-3 “Combining Data from 3 Forms into 1 Output Record” can be reformatted in many different ways. For example, Figure 5-4 “Reformat Data from 3 Forms into 2 Output Records” shows how this same data could be combined into two output records with data from forms A and B appearing in both records. Note that when the same field appears more than once, it must be given a unique field name for each occurrence (this is not specifically shown in Figure 5-4 “Reformat Data from 3 Forms into 2 Output Records”)

Figure 5-4 Reformat Data from 3 Forms into 2 Output Records

Reformat Data from 3 Forms into 2 Output Records

Separating Data into Several Records

In the following example, Figure 5-5 “Separating Data from 1 Form into Several Records”, data entered on form A is separated into three output records, each a fixed length of 40 bytes. Data from a subsequent form is written to a single 40-byte record. If any group of data is less than the 40-byte record length, the record is padded with blanks. The data cannot be formatted to exceed the record length.

Figure 5-5 Separating Data from 1 Form into Several Records

Separating Data from 1 Form into Several Records

Reformatting Repeating Forms

In Figure 5-6 “Reformatting Data from Repeating Forms”, form B is a repeating form that may occur a variable number of times. The reformat file in this example causes data entered on forms A, B, and C to be written to a single variable length output record. Note that if repeating form B causes so much data to be written to the output record that the maximum record length is exceeded, data (possibly significant) is truncated when REFORMAT is run.

Figure 5-6 Reformatting Data from Repeating Forms

Reformatting Data from Repeating Forms

Suppose data entered on one form can follow data entered on either of two different forms, and you want to generate separate records depending on the sequence in which the forms appear. In such a case, you can set up a reformat file as shown in Figure 5-7 “Reformatting Data Based on Form Sequences” Note that form B (a repeating form) appears as a reformat identifier and also as a succeeding form in other input forms sequences.

Figure 5-7 Reformatting Data Based on Form Sequences

Reformatting Data Based on Form Sequences

Separating Data from One Batch File into Several Output Files

A separate reformat file must be established for each different output file. In Figure 5-8 “Generating 2 Output Files from 1 Batch File”, data entered on forms A and B is written as a single record to one output file. Data from forms A and C is written as two records to a second output file; data from form B is not written to output file 2.

Figure 5-8 Generating 2 Output Files from 1 Batch File

Generating 2 Output Files from 1 Batch File
Feedback to webmaster