open-insight/LSL2/STPROC/RDS_RECIPE_DEP_TIME_ML_VALID.txt
Infineon\StieberD 7762b129af pre cutover push
2024-09-04 20:33:41 -07:00

53 lines
1.7 KiB
Plaintext

compile subroutine rds_recipe_dep_time_ml_valid(ConvType, DataIo, Branch, ReturnedValue)
begin condition
pre:
post:
end condition
$insert logical
$insert msg_equates
$insert dict_equates
declare function msg, get_property, set_property, fieldcount, rds_comm
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'
DepLimits = get_property( @window:'.DEP_TIME_LIMITS', 'TEXT' )
DataIo = iconv( DataIo, 'MD1' )
DataIo = oconv( DataIo, 'MD1' )
if DataIo then
Min = field( DepLimits, '~', 1 )
Max = field( DepLimits, '~', 2)
if ( Min <> '' ) and ( Max <> '' ) then
if ( DataIo >= Min ) and ( DataIo <= Max ) then
* IS WITHIN THE SPECIFIED LIMITS
end else
* JUST WARN THE USER, BUT DON'T INVALIDATE
MsgInfo = ''
MsgInfo<mtext$> = quote(DataIo):' is out of the control limits of ':quote(DepLimits)
MsgInfo<micon$> = '!'
Void = msg( '', MsgInfo )
end
end
end else
MsgInfo = ''
MsgInfo<mtext$> = 'Invalid entry...'
MsgInfo<micon$> = '!'
Void = msg( '', MsgInfo )
status() = invalid_nomsg$
end
case ConvType = 'OCONV'
ReturnedValue = DataIo
case otherwise$
ReturnedValue = ''
status() = invalid_conv$
end case
return