lrt_save_parm
| Correlating Functions |
Saves a portion of a character array (such as a STRING or CARRAY buffer) to a parameter.
int lrt_save_parm( char *buffer, int offset, int parm_len, char *parm_name );
| buffer | The STRING or CARRAY buffer whose contents you want to save. |
| offset | The offset into the array where you want to begin saving. |
| parm_len | The number of characters to save. |
| parm_name | Parameter name to be used in subsequent lrt statements to refer to the saved information. Name is enclosed in double-quotes. |
The lrt_save_parm function saves a portion of a character array to a parameter specified by parm_name. This function saves the number of characters specified by parm_len, starting at the offset specified by offset.
The lrt_save_parm function is used for correlating within a script. Instead of using the actual result fetched during a query, you replace the constant value with a parameter. This parameter can then be used by other database statements within the same script.
Return Values
If this function fails, it returns a negative value. If it succeeds, it returns 0.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
In the following example, an employee id needs to be saved for a later use. The recorded value was "G001" as shown in the output.
lrt_tpcall:227, PprLoad, 1782
...
123 "G001"
127 "..."
128 "Claudia"
/* Request CARRAY buffer 57 */
lrt_memcpy(data_0, buf_143, 227);
tpresult_int = lrt_tpcall("PprLoad",
data_0, 227, &data_1, &olen, TPSIGRSTRT);
lrt_save_parm(data_1, 123, 4, "empid");
"X"
"\x89\x0\x0\x0\xb\x0"
"SPprLoadReq"
"\xff\x0\x10\x0\x0\x4\x3\x6"
"<empid>" // G001
"\x7"
"Claudia"
"\xe"
"LAST_NAME_SRCH"
...Reply Buffer received.
lrt_save_parm is placed immediately after the reply buffer received from the "PprLoad" service, using offset 123.
In the .vdf file, the recorded value, "G001", is replaced with the parameter empid.
char buf_145[] = "\xf5\x0\x0\x0\x4\x3\x2\x1\x1\x0\x0\x0\xbc\x2\x0\x0\x0\x0\x0\x0"

