SetLong Function

Action

Copies a long value (4-byte signed integer value) into a data structure at a specified position. You must declare a BDL string before using this function.

Include file

Kernel.bdh

Syntax

SetLong( inout sString    : string,
         in    nPos       : number,
         in    nLong      : number,
         in    nByteOrder : number optional ) :boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sString BDL string corresponding to the data structure
nPos Insert position in the BDL string, where the first position is 1 (not 0)
nLong Long value
nByteOrder

Specifies the byte order that is applied when a value is set (optional). This parameter can be one of the following:

  • OPT_LITTLE_ENDIAN. Microsoft byte order (default).

  • OPT_BIG_ENDIAN. Network, Apple, Java byte order.

Example

dcltrans
  transaction TSetLong
  const
    SIZE_STRUCT := 32;
  var
    myBDLstring : string(SIZE_STRUCT);
    bOk         : boolean;
  begin
    // Set a 4-byte signed integer value at position 4
    // in the BDL string myBDLstring and thereby (through mapping) 
set
    // the element myLong in Struct1
    bOk := SetLong(myBDLstring, 4, -12345);
    if bOk then
      write("myLong successfully set to -12345"); writeln;
    else
      write("error setting myLong"); writeln;
    end;
  end TSetLong;

Output

myLong successfully set to -12345