compile subroutine react_num_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition
declare function msg, get_property, set_property
declare subroutine update_index, extract_si_keys

$insert logical
$insert quote_equ
$insert msg_equates

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'
      if DataIo matches "1A2N" then
          convert @lower_case to @upper_case in DataIo
          if index( DataIo, 'T', 1 ) or index( DataIo, 'M', 1 ) then
		      status() = valid$
	          ReturnedValue = DataIo
		  end else
		      MsgInfo = ''
		      MsgInfo<mtext$> = 'City code is invalid...Enter T=Tempe or M=Mesa.'
		      MsgInfo<micon$> = '!'
		      Void = msg( '', MsgInfo )
		      status() = invalid_nomsg$
		  end
      end else 
          MsgInfo = ''
          MsgInfo<mtext$> = 'You must enter as "CRR" C=City code i.e. T=Tempe, M=Mesa; RR=Reactor number i.e 01-19.'
          MsgInfo<micon$> = '!'
          Void = msg( '', MsgInfo )
          status() = invalid_nomsg$
      end
   case ConvType = 'OCONV'
      * no output
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return
