WebTelnetSetRecordString Function

Action

Sets the string value of a field in a data record that is being prepared for transmission to a terminal services server.

Include file

WebAPI.bdh

Syntax

WebTelnetSetRecordString( in hHandle : number,
  in sFieldname : string, 
  in sValue : string,
  in iLen : number optional ) : boolean;

Return value

  • true if the operation was successful

  • false otherwise

Parameter Description
hHandle

Valid handle to a data record that is being prepared, from a previous WebTelnetSendRecordPrepare command.

sFieldname

Name of the field. Must match one of the field names embedded in the data record previously specified in a WebTelnetSendRecordPrepare command, in the format: “%s###”, such as “%s1”.

sValue

Value to be assigned to the field specified by sFieldname. This string value will be dynamically inserted in the data record when it is transmitted to the terminal server.

iLen

Length of the value to insert (optional). If sValue is longer than iLen, it will be cut off at iLen. If not specified, the value is zero, meaning that sValue can be of any length.

Example

dcltrans
  transaction TInit
  begin
    StrSetHostCP(37); // 37    (IBM EBCDIC - U.S./Canada)
    ErrorAdd(FACILITY_WINSOCK, 18, SEVERITY_TRANS_EXIT);
  end TInit;

  transaction TMain
  var
    hHandle0 : number;
    hWeb0    : number;
  begin
    WebTcpipConnect(hWeb0, "My.Telnet.Host.IP", 5558);
    WebTcpipSetTelnetMode(hWeb0, TERMINAL_TYPE_3270, 80, 24, true, TELNET_MODEOPT_RFC_1576 | TELNET_MODEOPT_AUTO_RECV | 
      TELNET_MODEOPT_3270E_AUTO_REPLY);
    WebTelnetRecvCommand(hWeb0, TELNET_CMD_DO, TELNET_OPT_TN3270E);
    WebTelnetSendCommand(hWeb0, TELNET_CMD_WILL, TELNET_OPT_TN3270E);
    WebTelnetRecvSubNegotiation(hWeb0, TELNET_OPT_TN3270E);
    WebTelnetSendSubNegotiation(hWeb0, TELNET_OPT_TN3270E, TN3270E_CMD_DEVICE_TYPE + TN3270E_CMD_REQUEST + "IBM-3278-2-E");
    WebTelnetRecvSubNegotiation(hWeb0, TELNET_OPT_TN3270E);
    WebTelnetSendSubNegotiation(hWeb0, TELNET_OPT_TN3270E, TN3270E_CMD_FUNCTIONS + TN3270E_CMD_REQUEST + TN3270E_FUNC_BIND_IMAGE
       + TN3270E_FUNC_SYSREQ);
    WebTelnetRecvSubNegotiation(hWeb0, TELNET_OPT_TN3270E);
    WebTelnetSendSubNegotiation(hWeb0, TELNET_OPT_TN3270E, TN3270E_CMD_FUNCTIONS + TN3270E_CMD_IS);
    WebTelnetScreenRecvRecordsUntilCursor(hWeb0, 26, 10);
 
    ThinkTime(8.7);
    WebTelnetSendRecordPrepare(hHandle0, "\h00000000007D4C7E1140C4" + StrToHostCP("1") + "\h114BE9" + "%s1" + "\h114CC3" + "%s2"
       + "\h114CF9" + "%s3" + "\h114EC9" + "%s4" + "\h1150E9" + "%s5" + "\h115B61" + StrToHostCP(
      "Please type your userid.                                                       "));
    WebTelnetSetRecordString(hHandle0, "%s1", StrToHostCP("USER1   "));
    WebTelnetSetRecordString(hHandle0, "%s2", StrToHostCP("        "));
    WebTelnetSetRecordString(hHandle0, "%s3", StrToHostCP("USER1   "));
    WebTelnetSetRecordString(hHandle0, "%s4", StrToHostCP("   "));
    WebTelnetSetRecordString(hHandle0, "%s5", StrToHostCP("        "));
    WebTelnetSendRecordExecute(hWeb0, hHandle0);
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
 
    ThinkTime(2.3);
    WebTelnetSendRecordPrepare(hHandle0, "\h00000000007D40C4" + StrToHostCP(
      "acctE0012I Signon complete at V00F, for user USER1. Local security is disabled. 13:17:29"));
    WebTelnetSendRecordExecute(hWeb0, hHandle0);
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");
 
    WebTelnetSendRecordPrepare(hHandle0, "\h00000000007D4AF3114AD5" + "%s3" + "\h114AE2" + "%s4");
    WebTelnetSetRecordString(hHandle0, "%s3", StrToHostCP("d"));
    WebTelnetSetRecordString(hHandle0, "%s4", StrToHostCP("12345"));
    WebTelnetSendRecordExecute(hWeb0, hHandle0);
    WebTelnetScreenRecvRecordsUntilStatus(hWeb0, "Keyboard locked", "False");

    ThinkTime(9.9);
    WebTelnetSendRecord(hWeb0, "\h00000000006D"); // •••••m
    WebTelnetRecvRecord(hWeb0);
 
    ThinkTime(2.1);
    WebTelnetSendRecordPrepare(hHandle0, "\h00000000007D40C4" + StrToHostCP("exit"));
    WebTelnetSendRecordExecute(hWeb0, hHandle0);
    WebTelnetRecvRecordsUntilClose(hWeb0);
    WebTcpipShutdown(hWeb0);
end TMain;