JoltGetString Function

Action

Retrieves the string from a string item (“java.lang.String” in Java) of a Jolt object attribute. This function is provided to retrieve strings from both JoltSessionAttributes and JoltRemoteService object attributes.

Include file

Jolt.bdh

Syntax

JoltGetString( in  hJolt       : number,
               in  sAttribute  : string,
               in  sDefault    : string,
               out sString     : string,
               in  nStringSize : number optional,
               in  nOccurrence : number optional): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
hJolt Handle to a JoltSessionAttributes or JoltRemoteService object that was created with JoltSessionAttributesNew or JoltRemoteServiceNew, respectively
sAttribute Name of the attribute that is to be accessed
sDefault String that the function returns if the specified attribute or item does not exist
sString Buffer receiving the string
nStringSize Size of the buffer that receives the string (optional).
nOccurrence

Index of the item that is to be retrieved (optional). The index of an attribute’s first item is 1 (not 0).

If this parameter is omitted, the attribute’s first item is retrieved.

Note: This parameter is ignored if hJolt represents a JoltSessionAttributes object.

Example

var
  hSession, hSessionAttr, hRemoteService: number;
 dcltrans
  transaction TInit
  begin
    JavaSetOption(JAVA_VERSION, JAVA_V11);
    JavaSetOption(JAVA_HOME, "c:/jdk1.1.7");
    JavaSetOption(JAVA_CLASSPATH, "c:/jdk1.1.7");
    JoltInit();    hSessionAttr := JoltSessionAttributesNew();
    JoltSetString(hSessionAttr, APPADDRESS, "//lab:8000");
    hSession := JoltSessionNew(hSessionAttr, "", "ATM", "", "");
    hRemoteService := JoltRemoteServiceNew("TOUPPER", hSession);
  end TInit;

  transaction TMain
  var
    sString: string;
  begin
    JoltSetString(hRemoteService, "STRARG", "hello world!");
    JoltCall(hRemoteService);
    JoltGetString(hRemoteService, "RESULT", "", sString);
    writeln(sString);
  end TMain; 
  transaction TShutdown
  begin
    JoltEndSession(hSession);
    JoltFreeObject(hRemoteService);
    JoltFreeObject(hSession);
    JoltFreeObject(hSessionAttr);
  end TShutdown;

See also

Java: bea.jolt.JoltSessionAttributes class, bea.jolt.JoltRemoteService class