Software AG Products 2.4.1 | Reference Guide | Declaration Command | field-expressions | Elementary Fields
 
Elementary Fields
Simple Fields
The field expressions may contain a list of elementary fields specifying their full names. Adabas Pre-Compiler generates a definition for every field in the record buffer according to the Predict definition and the appropriate defaults. For example:
@ADADCL2,EMPLOYEES PERSONNEL-ID, NAME SEX BIRTH.
The record buffer definition is:
01 RECORD-BUF2
02 NAME2 PIC X(20).
02 SEX2 PIC X.
02 BIRTH2 PIC 9(6).
Redefined Fields
Redefinition may be specified in Predict to a field. All Predict field types can be redefined, including group fields, periodic groups and multiple values.
Adabas Pre-Compiler automatically generates this redefinition in the record buffer. The only restriction is that in PL/I, redefinition of a field within a periodic group is allowed only if the periodic group does not belong to another periodic group. In COBOL, the redefinition structure name is generated according to the default in the Predict defaults for COBOL generation.
For example:
@ADADCL7, FILE5, ACCT-A ACCT-B ACCT-C.
It is assumed that FILE5 is defined in Predict as follows:

Type Level Short Name Field Name Format Length
1 FA ACCT-A A 25
1 FB ACCT-B A 15
RE 1 ACCT-B
2 FILLER A 10
2 ACCT-R1 A 5
RE 1 ACCT-B
2 ACCT-R2 A 3
2 ACCT-R3 A 12
1 FC ACCT-C N 7
In COBOL, the record buffer definition is:
01 RECORD-BUF7.
02 ACCT-A7 PIC X(25)
02 ACCT-B7 PIC X(15).
02 ACCT-B7-REGR REDEFINES ACCT-B7.
03 FILLER7 PIC X(10).
03 ACCT-R17 PIC X(5).
02 ACCT-B7-REGR1 REDEFINES ACCT-B7.
03 ACCT-R27 PIC X(3).
03 ACCT-R37 PIC X(12).
02 ACCT-C7 PIC 9(7).
In PL/I, the record buffer definition is:
DCL 1 RECORD_BUF7_1,
2 ACCT_A7 CHAR (15),
2 ACCT_B7 CHAR (15),
2 ACCT_C7 PIC ’(6)99’,
RECORD-BUF7 BASED (ADDR (RECORD_BUF7_1));
DCL 1 ACCT_B7_ST BASED (ADDR(ACCT_B7)),
2 FILLER1 CHAR (10),
2 ACCT_R17 CHAR(5);
DCL 1 ACCT_B7_ST1 BASED (ADDR (ACCT_B7)),
2 ACCT_R27 CHAR (3),
2 ACCT_R37 CHAR (12);
Long Alpha Fields
A long alpha field is a special definition of an alphanumeric field whose length is a variable length that can be as long as 16K bytes.
Because it is a variable field, Adabas returns its value together with an inclusive two-byte long field before the long alpha field within the record buffer.
Adabas Pre-Compiler generates the long alpha field in the record buffer as two separate elements. The first element is the field length as two binary bytes with the same name suffixed with -LEN. The second element is the field itself as a character string with the maximum length defined in Predict, with the name suffixed with -TXT.
Because Adabas returns the value of the field as a variable, it is impossible to have a definition of another field following the long alpha field in the record buffer. Therefore, the following restrictions apply:
*The long alpha field may be generated as the last element in the record buffer.
*Only an elementary field is supported as a long alpha field.
For example:
@ADADCL2,TEST1, NAME LONG-FIELD.
The record buffer definition is:
01 RECORD-BUF2
02 NAME2 PIC X(20).
02 LONG-FIELD2-LEN PIC 9(4) COMP.
02 LONG-FIELD2-TXT PIC X(16000).
Relational Null Fields
A relational null field is a special field that contains an indicator specifying whether this field has a value or is a null field. This indicator appears in the Adabas record buffer. The definition of a null field in Predict has R or U in the field suppression attribute and the field has to be defined in Adabas as a relational null field.
Adabas Pre-Compiler generates the relational null field in the record buffer as two separate elements. The first element is the null value indicator as two binary bytes with the same name of the field prefixed with S-. The second element is the field itself.
When the record is read from the database, a value of 0 in the null field indicator indicates that the value in the field itself is a real value. A value of -1 (X’FFFF’) in the null field indicator indicates that the field itself has no value and it is a real null field.
Before updating the record (@UPDATE or @ADD), set the null field indicator in the record buffer to the desired value:
*For the null field to be empty, set the null field indicator to -1. Adabas ignores the value of the field in the record buffer.
*For the null field to contain a real value, set the null field indicator to 0 and set the real value to the field itself. Adabas takes the value from the field and updates the record.
The following example assumes that the field NULL-FIELD is defined as a five-character string and its suppression type in Predict is R.
@ADADCL2,TEST1, NAME NULL-FIELD.
The record buffer definition is:
01 RECORD-BUF2
02 NAME2 PIC X(20).
02 S-NULL-FIELD2 PIC 9(4) COMP.
02 NULL-FIELD2 PIC X(5).