BCD Conversion

The BCD Conversion action converts data from a BCD format into a numeric format. The value that was converted from a BCD format can be stored in either an integer, an unsigned integer, or a floating point numeric format.The action can also convert integer, unsigned integer, or floating point data into a BCD format. 

A BCD Conversion can be done on an individual data element or an array of data elements.

Parameter descriptions

Parameter Description
Conversion The type of conversion to be performed, either From BCD or To BCD. The From BCD option will convert BCD data into a numeric format, while the To BCD option will convert numeric data into a BCD format.
Input Data Type The data type of the input data.

This is the format of the variables that contain the BCD values, if the From BCD conversion option is selected. The following options are available if the Conversion parameter is From BCD.

  • UINT1
  • UINT2
  • UINT4
  • UINT8

This is the format of the variables that contain the numeric values, if theTo BCDconversion option is selected. The following options are available if the Conversion parameter isTo BCD.

  • UINT1
  • UINT2
  • UINT4
  • FLOAT4
  • UINT8
  • FLOAT8
Output Data Type

The data type of the output data.

This is the format of the variables that contain the numeric values, if the From BCD conversion option is selected. The following options are available if the Conversion parameter is From BCD.

  • UINT1
  • UINT2
  • UINT4
  • FLOAT4
  • UINT8
  • FLOAT8

This is the format of the variables that contain the BCD values, if the To BCD conversion option is selected. The following options are available if the Conversion parameter is To BCD.

  • UINT1
  • UINT2
  • UINT4
  • UINT8
Decimal Point

This option will indicate how the conversion will handle the decimal points when either the FLOAT4 or FLOAT8 data types are selected.
FLOAT4 data types will contain the following options:

  • 0, 1, 2, 3 or 4.

FLOAT8 data types will contain the following options:

  • 0, 1, 2, 3, 4, 5, 6, 7 or 8.

If the Conversion parameter is From BCD, the Decimal Point parameter dictates how many decimal places the value should be shifted to the right after it has been converted from its BCD format. For example if a value of 1234 is returned from the From BCD process and the Decimal Point parameter is 3, the value of 1.234 will be written to the FLOAT4 or FLOAT8 variable.

If the Conversion parameter is To BCD, the Decimal Point parameter dictates how many decimal places the value should be shifted to the left before it is converted to a BCD format. For example if a FLOAT4 variable has a value of 13.64316 and the Decimal Point parameter is 2, the value of 1364 will be converted into a BCD value.

Number of Elements This is the number of elements that will be processed during the conversion. A value of 1 indicates the conversion should process one value. A value greater than 1 indicates that an array of values will be converted when the action is executed.

Input tab

Parameter Description
Input Value The element that contains the data that will be the source of the BCD conversion.

The value in the Logical column is set based on the value selected in the Input Data Type parameter. The value in the Count column is set based on the value entered in the Number of Elements parameter.

Output tab

Parameter Description
Output Value The destination variable where the converted data is copied.

The value in the Logical column is set based on the value selected in the Output Data Type parameter. The value in the Count column is set based on the value entered in the Number of Elements parameter.

resultStatus

A numeric value that will be 0 (zero), if the conversion was successful. A value less than 0 will indicate that an error occurred during the conversion.
Possible errors include.

  • -5214: The variable defined in the Input Value parameter is missing.
  • -5215: The variable defined in the Output Value parameter is missing.
  • -6254: In the case where the conversion is from a numeric value To BCD, the value being converted is not in a valid BCD format.
  • -6254: In the case where the conversion is From BCD the value converted from a BCD is too large to fit in the output variable. For example if the BCD value converted to a value > 256 will not fit in an Unsigned Int. The largest value that can be written to a FLOAT4 variable is 4294967000. Attempting to write a value larger than this will result in an error.
Element in Error This will indicate the first array element that contained a value that could not be converted because it was not in a valid BCD format, or contained a value that could not be converted into a valid BCD format.