compile subroutine tool_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition

$insert logical
$insert quote_equ
$insert msg_equates
$insert wo_log_equ
declare function msg, get_property, set_property, fieldcount
declare subroutine extract_si_keys

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
equ CrLf$          to char(13):char(10)

ReturnedValue = DataIo       
status() = Valid$              
*
begin case
   case ConvType = 'ICONV'
		AllTools = xlate( 'LISTBOX_CONFIG', 'ALLTOOLS', '', 'X' )
		locate DataIo in AllTools using @vm setting Fpos else
		   MsgInfo = ''
		   MsgInfo<mtext$> = DataIo:' is not a valid tool.'
		   MsgInfo<micon$> = 'H'
		   Void = msg( '', MsgInfo )
		   status() = invalid_nomsg$
		end   
   case ConvType = 'OCONV'
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return
