COMPILE SUBROUTINE Tablename_Conv(ConvType, DataIo, Branch, ReturnedValue)

DECLARE FUNCTION Msg

$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
Status() 		= Valid$

ValidTables = XLATE( 'CONFIG', 'TABLENAMES', '', 'X' )
TablesOut = ValidTables<1>
TablesIn  = ValidTables<2>

BEGIN CASE
	CASE ConvType = 'ICONV'
		LOCATE DataIo IN TablesOut USING @VM SETTING Fpos THEN
			ReturnedValue = TablesIn<1,Fpos>
		END ELSE
			ReturnedValue = ''
		END
      
	CASE ConvType = 'OCONV'
		LOCATE DataIo IN TablesIn USING @VM SETTING Fpos THEN
			ReturnedValue = TablesOut<1,Fpos>
		END ELSE
			ReturnedValue = ''
		END
      
	CASE OTHERWISE$
		ReturnedValue = ''
		Status() = INVALID_CONV$
      
END CASE

RETURN
