Field-encoding (function code 0)
You need to provide the input and output that are required for a field-encoding operation.
On entry
The input that is provided to the field-encoding operation, and the output that is required, are as follows:
| Register | Contains |
|---|---|
| 1 | Address of the field procedure parameter list (FPPL); see Parameter list (FPPL) for field procedures for a schematic diagram. |
| 2 through 12 | Unknown values that must be restored on exit. |
| 13 | Address of the register save area. |
| 14 | Return address. |
| 15 | Address of entry point of exit routine. |
The contents of all other registers, and of fields not listed, are unpredictable.
The work area is contiguous, uninitialized, and of the length specified by the field procedure during field-definition.
| Field | Contains |
|---|---|
| FPBFCODE | 0, the function code |
| FPBWKLN | The length of the work area |
| Field | Contains |
|---|---|
| FPVDTYPE | The numeric code for the data type of the column value, as shown in Table 1. |
| FPVDVLEN | The length of the column value. |
| FPVDVALE | The column value; if the value is a varying-length string, the first halfword contains its length. |
| Field | Contains |
|---|---|
| FPVDTYPE | The numeric code for the data type of the field value. |
| FPVDVLEN | The length of the field value. |
| FPVDVALE | An area of unpredictable content that is as long as the field value. |
The modified FPPVL, produced by the field procedure during field-definition, is provided.
On exit
| Register | Contains |
|---|---|
| 2 through 12 | The values that they contained on entry. |
| 15 | The integer zero if the column described in the CVD is valid for the field procedure; otherwise the value must not be zero. |
The FVD must contain the encoded (field) value in field FPVDVALE. If the value is a varying-length string, the first halfword must contain its length.
| Field | Contains |
|---|---|
| FPBRTNC | An optional 2-byte character return code, defined by the field procedure; blanks if no return code is given. |
| FPBRSNC | An optional 4-byte character reason code, defined by the field procedure; blanks if no reason code is given. |
| FPBTOKP | Optionally, the address of a 40-byte error message residing in the work area or in the field procedure's static area; zeros if no message is given. |
Errors signalled by a field procedure result in SQLCODE -681 (SQLSTATE '23507'), which is set in the SQL communication area (SQLCA). The contents of FPBRTNC and FPBRSNC, and the error message pointed to by FPBTOKP, are also placed into the tokens, in SQLCA, as field SQLERRMT. The meaning of the error message is determined by the field procedure.
All other fields must remain as on entry.