Field-decoding (function code 4)
You need to provide the input and output that are required for a field-decoding operation.
On entry
| Register | Contains |
|---|---|
| 1 | Address of the field procedure parameter list (FPPL); see Figure 1 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 | 4, 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 | The field value. If the value is a varying-length string, the first halfword contains its length. |
The modified FPPVL, produced by the field procedure during field-definition, is provided.
On exit
| Register | Contains |
|---|---|
| 2 through 12 | The values they contained on entry. |
| 15 | The integer zero if the column described in the FVD is valid for the field procedure; otherwise the value must not be zero. |
The CVD must contain the decoded (column) 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.