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

$insert logical
$insert msg_equates
declare function msg, get_property, set_property
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)

E1Reactors = '1/2/3/4/7/11/13'
* THIS SHOULD NOT BE USED ANYMORE GOING TO A MD1 FOR EPI_TIME/DEP_TIME
ReturnedValue = DataIo       
status() = Valid$
*
CurReactor = get_property( 'RDS.REACTOR', 'TEXT' )
locate CurReactor in E1Reactors using '/' setting Dum then
   UsingE1 = True$
end else
   UsingE1 = False$
end
*
begin case
   case ConvType = 'ICONV'
      * is it valid
      begin case
         case UsingE1
             if DataIo Matches "0N':'2N" else
                MsgInfo = ''
                MsgInfo<mtext$> = 'E1 Deposition times must be entered as MM:SS for minutes and seconds.'
                MsgInfo<micon$> = 'H'
                Void = msg( '', MsgInfo )
                status() = invalid_nomsg$
             end   
         case DataIo Matches "0N"
            * this is ok a whole number
         case DataIo Matches "0N'.'1N"
            * now check to see if first portion before decimal is over 7
            if field( DataIo, '.', 1 ) > 7 else
                MsgInfo = ''
                MsgInfo<mtext$> = 'Verify your Deposition time.'
                MsgInfo<micon$> = 'H'
                Void = msg( '', MsgInfo )
                status() = invalid_nomsg$
			end
         case DataIo Matches "0N':'2N"
            if field( DataIo, ':', 1 ) > 0 else
                MsgInfo = ''
                MsgInfo<mtext$> = 'If you are entering seconds, then enter as a whole number.'
                MsgInfo<micon$> = 'H'
                Void = msg( '', MsgInfo )
                status() = invalid_nomsg$
            end
         case Otherwise$
            MsgText = 'There are three options for entering the time':CrLf$:Crlf$
            MsgText:= '1) Enter a whole number for seconds.':CrLf$:"58":CrLf$:Crlf$
            MsgText:= '2) Enter a decimal number using tenths only':CrLf$:'12.5':CrLf$:Crlf$
            MsgText:= '3) Enter as MM:SS ( Minutes:Seconds ).':CrLf$:'3:25':CrLf$:Crlf$
            MsgInfo = ''
            MsgInfo<mtext$> = MsgText
            MsgInfo<micon$> = 'H'
            Void = msg( '', MsgInfo )            
            status() = Invalid_nomsg$    
      end case
   case ConvType = 'OCONV'
      * no output
      ReturnedValue = DataIo
   case otherwise$
      ReturnedValue = ''
      status() = invalid_conv$
end case
return
