|
|
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 |
|
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. 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:
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:
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. 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. 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”) 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. 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. 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. 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. |
|