Field Maintenance

The Field Maintenance screen is shown in the section Field Maintenance Menu.

Note:
Predict does not perform complete consistency checks when executing field maintenance functions. It is therefore possible to spoil the integrity of field lists of files temporarily. Consistency checks are performed, however, when field lists are cataloged.

Predict maintenance functions applying particularly to objects of type field and aspects of standard maintenance functions that are specific to fields are described in the sections below.

Note:
Standard maintenance functions are described in the section Maintenance in the Predict Reference documentation.


Add a Field - Code A

The function Add a Field can be used to add a field

  • to the end of the specified file (copy field ID=blank)

  • to the top of the specified file (copy field ID=*)

  • after a specified field (copy field ID=Field_2) in the specified file.

The position of a new field is determined with the parameters Copy field ID and Copy file ID as follows.

Parameter/Function ADD to end ADD to top ADD to position
Field ID Field_1  Field_1  Field_1 
in file File_1  File_1  File_1 
Copy field ID - * Field_2 
Copy file ID - - -

Command: ADD ELEMENT

Copy Field - Code C

This function is useful for creating a new field entry. A field can be copied:

  • to the end of the same file and renamed (copy field ID=Field_2)

  • to another file (copy file ID=File_2) to a position after a specified field (copy field ID=Field_2)

  • to the end of another file (copy file ID=File_2).

The position of a copied field is determined with the parameters Copy field ID and Copy file ID as follows.

Parameter/Function COPY and rename COPY to position COPY to end
Field ID Field_1  Field_1  Field_1 
in file File_1  File_1  File_1 
Copy field ID Field_2  Field_2   
Copy file ID File_2  File_2 

Command: COPY ELEMENT

Move Field within a File - Code H

This function is used to change the order of fields in a file. A field can be moved:

  • to the top of the file (copy field ID=*)

  • to a position after a specified field (copy field ID=Field_2).

The position of a moved field is determined with the parameters Copy field ID and Copy file ID as follows.

Parameter/Function MOVE to top MOVE to position
Field ID Field_1  Field_1 
in file File_1  File_1 
Copy field ID Field_2 
Copy file ID

If the function Move is applied to group fields (type GR, PE, PC), all fields of the group will be moved.

Command: MOVE ELEMENT

Purge Field - Code P

Predict objects of type field can be deleted with the Purge function (code P). The following rules apply.

  • If the field to be deleted is a group, it is possible to delete all fields in the group.

  • If the field is a standard field, connections to derived fields are deleted.

  • If a field in a master file is deleted, all fields in userviews related to this field are deleted as well.

If you confirm the Purge function with DELETE,

  • The field and its redefinition will be purged, and

  • All file relations based on this field will be set to Documented.

Command: PURGE ELEMENT

Redefine Field - Code R

The function Redefine Field (code R) invokes the list editor for defining a redefinition (see screen below). A redefinition must be cataloged. Predict reports errors in a redefinition.

Command: REDEFINE ELEMENT

Note:
No consistency check is performed for files of type Conceptual or Standard.

>                     > + Fi: HNO-FI1                          L: 1    S: 1
    Ty L Field ID                         F  Cs Length   Occ   D U DB S      All
    *- - -------------------------------- *-  - -------- ----- * * -- *
       1 HNO-EL1                          A         2.0            AA N
   
   
   
   
   

  

Field Types that can be Redefined

blank Normal fields
DV Derived fields (SQL)
GR Group
HM Hyperdescriptors as a multiple value fields
HP Hyperdescriptors as a fields of a periodic group
HQ Hyperdescriptors as a multiple value fields of a periodic group
HY Hyperdescriptors
MC Multiple value fields with automatic counter
MU Multiple value fields
OD Collation descriptor
PC Periodic group with automatic counter
PE Periodic group
QN SEQNO field
SB Subfields/descriptors
SP Superfields/descriptors

If a field of type MU, MC, PE or PC is redefined, the whole array (including all occurrences) is redefined. When redefining fields of these types, the occurrence number must be specified.

Position and Format of a Redefinition

A redefinition is started by defining a field of type RE having the same level and Field ID as the field to be redefined.

This field definition has to directly follow the redefined field/group.

 Ty L Field ID                         F  Cs Length   Occ
 *- - -------------------------------- *-  - -------- -----
      1   FIELD-TEST                   A     20
 RE   1   FIELD-TEST
      2   TEST-REDEF1                  A     5
      2   FILLER                       A     5
      2   TEST-REDEF2                  A     5
  

Format and Type of Fields within the Redefinition

The following field types can be used within a redefinition: blank, MU, GR or PE. Redefinition within the redefinition is possible. The number of occurrences must be specified for MU and PE fields. Format of occurrences are increased to N5. The occurrences can be specified in the Edit Elements of a File screen.

Properties of Fields within a Redefinition

Redefined fields have the following properties:

  • The sum of the length of all fields in a redefinition must not be greater than the length of the field/group being redefined.

  • The field level within a redefinition cannot be greater than 9.

  • PE in PE is possible.

  • The special field name FILLER is not tested for uniqueness and can be used to exclude parts of the original field from redefinition (as in previous versions of Predict).

  • A field can be identified by a maximum of three indexes.

  • Within redefinitions, Gr.structur must not be set to N.

Purge and Rename a Redefined Field

If a field that has been redefined is purged or renamed, all redefinitions of the field are purged or renamed as well.

Mapping of Natural Data Structures

Natural allows the definition of multiple arrays for one field. Data structures of this type cannot be defined in Predict and have to be circumscribed as shown in the two examples below.

Note:
A three-dimensional array is only possible for few file types; e.g. sequential (file type S).

Natural structure

1 GROUP      (1:2,1:4,1:3)
2 ELE   (A20)

Predict structure

PE 1 GROUP1               (2)
PE 2 GROUP2               (4)
PE 3 GROUP3               (3)
   4 ELE       A  20

Natural structure

1 ELE   (A20/1:2,1:4,1:3)

Predict structure

PE 1 GROUP1               (2)
PE 2 GROUP2               (4)
MU 3 ELE       A  20      (3)

Mapping of COBOL Data Structures

In Predict it is not possible to define new field attributes together with a redefinition (which is possible in COBOL).

An example of a COBOL structure using this feature and the Predict definition that is used to circumscribe the structure is shown below.

COBOL structure

01 FIELD-A   PIC X(A20).
01 FIELD-A-RED REDEFINES FIELD-A PIX X(1) OCCURS 10.

Predict structure

   1  FIELD-A        A 20.
RE 1  FIELD-A
MU 2  FIELD-A-RED    A 1   (10)

In COBOL it is not possible to redefine a PE or a MU field. An additional group field has to be inserted. Predict does this automatically when COBOL Copy Code is generated from a field in which a PE or a MU field is redefined.

An example of a Predict structure and the COBOL structure that circumscribes it is shown below.

Predict structure

MU 1  FIELD-MU       A 20  (10)
RE 1  FIELD-MU
   2  FIELD-MU-RED   A 200

COBOL structure

05 R-FIELD-MU
    10 FIELD-MU  PIC X(A20) OCCURS 10.
05 R-FIELD-MU-REGR REDEFINES R-FIELD-MU.
    10 FIELD-MU-RED PIX X(200).

Example

The following example defines the structure of a sequential file.

Typ  Lev  Field-name      F  Len  Occ  ADA
---  ---  --------------- -- ---  ---  ---
 *
 PE   1   PE-GROUP1                 2   AA
 PE   2   PE-GROUP2                 3   AB
 PE   3   PE-GROUP3                 2   AC
      4   PE-EL1          A   6         AD
      4   PE-EL2          P   5.2       AE
 RE   1   PE-GROUP1
      2   PE-ELE-COMP     A   120
 *
 MU   1   MU-FIELD        A   250   5   AF
 RE   1   MU-FIELD
 PE   2   PE-GR1                    5
 MU   3   MU-FIELD1       A   5     4
 RE   3   MU-FIELD1
      4   MU-FIELD1-1     A   15
      4   MU-FIELD1-2     A   5
      3   FLD01           A   10
 RE   3   FLD01
      4   FLD01-1         A   5
      4   FLD01-2         A   5
 RE   3   FLD01
 MU   4   FLD01-3         A   1     10
      3   FILLER          A   2
      3   FLD02           A   5
      2   FLD03           A   20
 GR   1   GROUP                         AG
      2   GR-ELE1         A   30        AH
      2   GR-ELE2         A   20        AI
 RE   1   GROUP
 PE   2   GR-PE                     50
      3   GR-PE-EL        A   1

Browse Through Fields of a File - Code B

The Browse through Fields of a File function invokes the Modify Field function for each field in the field list of a file. If a field is specified in the parameter Field ID, the functions starts with this field.

The function is useful when applying general changes to all fields in a file.

Command: BROWSE ELEMENT

Edit Field Expression - Code Y

Depending on the editor preferences specified in the Profile > Handling screen, either the Software AG Editor or the Natural-based Subquery Editor is called. See Derived Field Expression.

Command: EDIT ELEMENT EXPRESSION