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:

Begin program-specific programming interface information.The registers have the following information:
Table 1. Contents of the registers on entry
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.

The FPIB has the following information:
Table 2. Contents of the FPIB on entry
Field Contains
FPBFCODE 0, the function code
FPBWKLN The length of the work area
The CVD has the following following information:
Table 3. Contents of the CVD on entry
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.
The FVD has the following information:
Table 4. Contents of the FVD on entry
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

The registers have the following information:
Table 5. Contents of the registers 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.

The FPIB can have the following information:
Table 6. Contents of the FPIB on exit
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.End program-specific programming interface information.