compile subroutine rds_recipe_params_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 $insert recipe_info_array_equ 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' * VALIDATE ALL ROW ONE ENTRIES, CAUSE ROW TWO ARE THE LIMITS Array = get_property( @window:'.RECIPE_INFO', 'ARRAY' ) LimitArray = get_property( @window:'.RECIPE_LIMITS', 'ARRAY' ) DictColumns = get_property( @window:'.RECIPE_INFO', 'COLUMN' ) PosCnt = 1 for i = RecInfoDepTime$ to RecInfoEtch3$ ;* VALIDATE ALL VALS WITH THE COORESPONDING LIMIT ThisValue = Array if ( ThisValue <> '' ) then ThisColumn = DictColumns<1,1,PosCnt> TheseLimits = LimitArray LCL = field( TheseLimits, '~', 1 ) UCL = field( TheseLimits, '~', 2 ) * CONVERT THE DICT ITEM TO OUTPUT FOR USER INCASE OF ERROR convert @upper_case to @lower_case in ThisColumn convert '_' to ' ' in ThisColumn NewColumn = '' Scnt = fieldcount( ThisColumn, ' ' ) for j = 1 to Scnt ThisPiece = field( ThisColumn, ' ', j ) FirstChar = ThisPiece[1,1] RestChar = ThisPiece[2,999] convert @lower_case to @upper_case in FirstChar NewColumn:= FirstChar:RestChar:' ' next j NewColumn[-1,1] = '' * PASSED THE DICTIONARY INPUT CONVERSION NOW CHECK THE LIMITS * BUT ALLOW ENTRY IF INVALID if ( LCL <> '' ) and ( UCL <> '' ) then; * MUST HAVE BOTH LIMITS TO VALIDATE if ( ThisValue >= LCL ) and ( ThisValue <= UCL ) then * PASSED THE CONTROL LIMITS ALSO end else MsgInfo = '' MsgInfo = NewColumn:' ':quote( ThisValue ):' is out of the control limits of ':quote(TheseLimits) MsgInfo = '!' Void = msg( '', MsgInfo ) end end end PosCnt += 1 next i case ConvType = 'OCONV' ReturnedValue = DataIo case otherwise$ ReturnedValue = '' status() = invalid_conv$ end case return