COMPILE SUBROUTINE XLATE_CONV( ConvType, DataIo, SubrLabel, ReturnedValue )

/*
   DataIo will contain the data to be used as the key
   SubrLabel will consist of three parts:   PART1*PART2
            PART1 = the tablename to XLATE from
            PART2 = the columnname or number to retrieve 
*/
begin condition
pre:
post:
end condition
$insert logical

equ valid$         to 0    ;* successful
equ invalid_msg$   to 1    ;* bad data       -   print error message window
equ invalid_conv$  to 2    ;* bad conversion -          "         "
equ invalid_nomsg$ to 3    ;* bad but do not print the error message window

ReturnedValue = DataIo        ; * save off data input by user
status() = valid$             ; * assume successful conversion

begin case
   case ConvType = 'ICONV'
      * do nothing, there is no ICONV
      ReturnedValue = DataIo
   case ConvType = 'OCONV'
      convert '*' to @fm in SubrLabel
      TableName  = SubrLabel<1>
      ColumnName = SubrLabel<2>
      ReturnedValue = xlate( TableName, ReturnedValue, ColumnName, 'X')
      IF ReturnedValue = '' THEN ReturnedValue = DataIo						;* Added by JCH 12/2/2004
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return

