Tuxedo correlation
Tuxedo Vuser scripts require manual correlation. The following tasks describe how to correlate Tuxedo scripts.
Note: Design Studio is not supported for Tuxedo scripts.
To correlate statements, you modify your recorded script within the VuGen editor using one of the following LRT functions:
-
lrt_save[32]_fld_val. Saves the current value of an FML or FML32 buffer (a string in the form "name=<NAME>" or "id=<ID>") to a parameter.
-
lrt_save_parm. Saves a portion of a character array (such as a STRING or CARRAY buffer) to a parameter.
-
lrt_save_searched_string. Searches for an occurrence of a string in a buffer and saves a portion of the buffer, relative to the string occurrence, to a parameter.
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
When working with CARRAY buffers, VuGen generates log files during recording (with the .rec extension) and during replay (with the .out extension) which you can compare using the comparison utility. You can look at the differences between the recording and replay logs to determine which portions of CARRAY buffers require correlation. The following steps describe how to compare the log files.
-
Select View > Output to display the execution log and recording log for your script.
-
Examine the Replay Log tab.
-
Double-click on the statement in the execution log to start the comparison utility.
The error message should be followed by a statement beginning with the phrase: Use <comparison tool> to compare.
For more information, see Search for values that need correlation.
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
Use lrt_save_fld_val or lrt_save32_fld_val to save the contents of the FML or FML32 buffer. The following steps describe how to correlate statements using lrt_save_fld_val.
-
Insert the lrt_save_fld_val statement in your script where you want to save the contents of the current FML (or FML32) buffer.
-
Locate the lrt statements with the recorded values that you want to replace with the contents of the saved buffer. Replace all instances of the recorded values with the parameter name in curly brackets.
Example:
lrt_save_fld_val (fbfr, "name", occurrence, "param_name");
Example:
In the following example, a bank account was opened and the account number was stored to a parameter, account_id.
/* Fill the data_0 buffer with new account information*/ data_0 = lrt_tpalloc("FML", "", 512); lrt_Finitialize((FBFR*)data_0); lrt_Fadd_fld((FBFR*)data_0, "name=BRANCH_ID", "value=1", LRT_END_OF_PARMS); lrt_Fadd_fld((FBFR*)data_0, "name=ACCT_TYPE", "value=S", LRT_END_OF_PARMS); ... LRT_END_OF_PARMS); lrt_Fadd_fld((FBFR*)data_0, "name=LAST_NAME", "value=Doe", ...); lrt_Fadd_fld((FBFR*)data_0, "name=FIRST_NAME", "value=John", ...); lrt_Fadd_fld((FBFR*)data_0, "name=SAMOUNT", "value=234.12", ...); /* Open a new account and save the new account number*/ tpresult_int = lrt_tpcall("OPEN_ACCT", data_0, 0, &data_0, &olen_2, 0); lrt_abort_on_error(); lrt_save_fld_val((FBFR*)data_0, "name=ACCOUNT_ID", 0, "account_id"); /* Use result from first query to fill buffer for the deposit*/ lrt_Finitialize((FBFR*)data_0); lrt_Fadd_fld((FBFR*)data_0, "name=ACCOUNT_ID", "value={account_id}", LRT_END_OF_PARMS); lrt_Fadd_fld((FBFR*)data_0, "name=SAMOUNT", "value=200.11", ...);
In the above example, the account ID was represented by a field name, ACCOUNT_ID. Some systems represent a field by an ID number rather than a field name during recording.
You can correlate by field ID as follows:
lrt_save_fld_val((FBFR*)data_0, "id=8302", 0, "account_id");
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
The following steps describe how to correlate a string in a Tuxedo script by using the lrt_save_parm function. This function creates a correlation based on the location of a string within the buffer.
-
Insert an lrt_save_parm statement in your script, at the point where you want to save the contents of the current buffer.
-
Open the replay.vdf file from the Solution Explorer, and locate the buffer data that you want to replace with the contents of the saved buffer.
-
Replace all instances of the value with the parameter name in curly brackets.
Example:
In the following example, an employee ID from a CARRAY buffer must be saved for later use. The recorded value was "G001" as shown in the output.
lrt_tpcall:227, PprLoad, 1782 Reply Buffer received. ... 123 "G001" 126 "..." 134 "Claudia"
Insert lrt_save_parm using the offset, 123, immediately after the request buffer that sends "PprLoad" and 227 bytes.
/* 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, 9, "empid");
In the replay.vdf file, replace the recorded value, "G001", with the parameter, empid.
char buf_143[] = "\xf5\x0\x0\x0\x4\x3\x2\x1\x1\x0\x0\x0\xbc\x2\x0\x0\x0\x0\x0\x0" "X" "\x89\x0\x0\x0\xb\x0" "SPprLoadReq" "\xff\x0\x10\x0\x0\x4\x3\x6" "{empid}" // G001 "\x7" "Claudia" "\xe" "LAST_NAME_SRCH" ...
This function can also be used to save a portion of a character array within an FML buffer. In the following example, the phone number is a character array, and the area code is the first three characters. First, the lrt_save_fld_val statement saves the phone number to a parameter, phone_num. The lrt_save_parm statement uses lr_eval_string to turn the phone number into a character array and then saves the area code into a parameter called area_code.
lrt_save_fld_val((FBFR*)data_0, "name=PHONE", 0, "phone_num"); lrt_save_parm(lr_eval_string("{phone_num}"), 0, 3, "area_code"); lr_log_message("The area code is %s\n", lr_eval_string("{area_code}"));
![Closed](../../../../Skins/Default/Stylesheets/Images/transparent.gif)
The following steps describe how to correlate a string in a Tuxedo script by using the lrt_save_searched_string function. This function creates a correlation based on the location of a delimiter in the buffer (for example, correlate the string immediately after the first { ).
-
Insert an lrt_save_searched_string statement in your script where you want to save a portion of the current buffer.
-
Open the replay.vdf file from the Solution Explorer, and locate the buffer data that you want to replace with the contents of the saved buffer.
-
Replace all instances of the value with the parameter name in curly brackets.
Example:
In the following example, a Certificate is saved to a parameter for a later use. The lrt_save_searched_string function saves 16 bytes from the specified olen buffer, to the parameter cert1. The saved string location in the buffer, is 9 bytes past the first occurrence of the string "SCertRep".
This application is useful when the buffer's header information is different depending on the recording environment.
The certificate will come 9 bytes past the first occurrence of "SCertRep", but the length of the information before this string varies.
/* Request CARRAY buffer 1 */ lrt_memcpy(data_0, sbuf_1, 41); lrt_display_buffer("sbuf_1", data_0, 41, 41); data_1 = lrt_tpalloc("CARRAY", "", 8192); tpresult_int = lrt_tpcall("GetCertificate", data_0, 41, &data_1, &olen, TPSIGRSTRT); /* Reply CARRAY buffer 1 */ lrt_display_buffer("rbuf_1", data_1, olen, 51); lrt_abort_on_error(); lrt_save_searched_string(data_1, olen, 0, "SCertRep", 9, 16, "cert1");
Note: Offset is the offset from the beginning of the string.
See also: