SetChar Function

Action

Copies a one-byte signed character into a data structure at a specified position. You must declare a BDL string before using this function.

Include file

Kernel.bdh

Syntax

SetChar( inout sString : string,
         in    nPos : number,
         in    nChar : number ) : 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)
nChar Signed character, specified as ASCII code

Example

dcltrans
  transaction TSetChar
  const
    SIZE_STRUCT := 32;
  var
    myBDLstring : string(SIZE_STRUCT);
    bOk         : boolean;
  begin
    // Set a one-byte signed character at position 1
    // in the BDL string myBDLstring and thereby (through mapping)
    // set the element myChar in Struct1
    bOk := SetChar(myBDLstring, 1, ord('A'));
    if bOk then
      write("myChar successfully set to 'A'"); writeln;
    else
      write("error setting myChar"); writeln;
    end;
  end TSetChar;

Output

myChar successfully set to 'A'