SetFloat Function

Action

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

Include file

Kernel.bdh

Syntax

SetFloat( inout sString : string,
            in    nPos    : number,
            in    fFloat  : float ) : 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)
fFloat Float value

Example

dcltrans
  transaction TSetFloat  const
    SIZE_STRUCT := 32;
  var
    myBDLstring : string(SIZE_STRUCT);
    bOk         : boolean;
  begin
    // Set a 4-byte floating point value at position 16
    // in the BDL string myBDLstring and thereby (through mapping) 
set
    // the element myFloat in Struct1
    bOk := SetFloat(myBDLstring, 16, 12345.99);
    if bOk then
      write("myFloat successfully set to 12345.99");writeln;
    else
      write("error setting myFloat"); writeln;
    end;
  end TSetFloat;

Output

myFloat successfully set to 12345.99