compile subroutine rds_time_valid(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) * this is used so the time_in and time_out entries must be AM or PM * according to the current time. ReturnedValue = DataIo DataIo = iconv( DataIo, 'MT' ) ;* ICONVERT IT IN ORDER TO DO NUMERIC COMPARISON status() = Valid$ AMTime1 = iconv( '12:00:00AM', 'MT' ) AMTime2 = iconv( '11:59:59AM', 'MT' ) PMTime1 = iconv( '12:00:00PM', 'MT' ) PMTime2 = iconv( '11:59:00PM', 'MT' ) * RightNow = time() begin case case ConvType = 'ICONV' if ( RightNow >= AMTime1 ) and ( RightNow <= AMTime2 ) then * AM if ( DataIo >= AMTime1 ) and ( DataIo <= AMTime2 ) then * they entered the time in AM hours and is ok end else MsgInfo = '' MsgInfo = 'We are currently in the AM hours...Please verify that you are entering the correct time.' MsgInfo = 'H' Void = msg( '', MsgInfo ) *status() = invalid_nomsg$ *just warn do not force end end else * PM if ( DataIo >= PMTime1 ) and ( DataIo <= PMTime2 ) then * they entered the time in PM hours and is ok end else MsgInfo = '' MsgInfo = 'We are currently in the PM hours...Please verify that you are entering the correct time.' MsgInfo = 'H' Void = msg( '', MsgInfo ) *status() = invalid_nomsg$ *just warn do not force end end case ConvType = 'OCONV' * no output ReturnedValue = DataIo case otherwise$ ReturnedValue = '' status() = invalid_conv$ end case return