compile subroutine rds_lot_num_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition
declare function msg, get_property, set_property
declare subroutine 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'
      extract_si_keys( 'RDS', 'LOT_NUM', DataIo, Keys )
      if Keys then
          swap @vm with ', ' in Keys
          MsgInfo = ''
          MsgInfo<mtext$> = Quote(DataIo):' has been used in RDS number ':CrLf$:Keys
          MsgInfo<micon$> = 'H'
          Void = msg( '', MsgInfo )
          status() = invalid_nomsg$
      end else
          ReturnedValue = DataIo
      end
   case ConvType = 'OCONV'
      * no output
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return
