Compile Subroutine ErrMsg(ErrCodes) Declare Subroutine Msg, Set_Status DECLARE FUNCTION Create_Dialog $INSERT MSG_EQUATES EQU MSGID$ TO 1 ;* First value in ErrCodes EQU MSGPARMS$ TO 2 ;* Second value in ErrCodes EQU MSGTITLE$ TO 1 ;* Subvalue in MSGPARM EQU MSGTEXT$ TO 2 ;* Subvalue in MSGPARM Equate CRLF$ to \0D0A\ ;* CHAR(13):CHAR(10) for multiline messages IF NOT(ASSIGNED(ErrCodes)) THEN ErrCodes = 'Null Parameter Passed to ErrMsg Routine!' END IF INDEX(ErrCodes,@VM,1) = 0 THEN ErrCodes = ErrCodes:@VM ;* Changed to an append from a prepend. 2/5/2005 JCH IF ErrCodes[-1,1] = @FM THEN ErrCodes[-1,1] = '' CONVERT ']' TO @SVM IN ErrCodes ErrDispLines = '' ErrCodeCnt = COUNT(ErrCodes,@FM) + (ErrCodes NE '') FOR M = 1 TO ErrCodeCnt MsgID = ErrCodes MsgParms = FIELD(ErrCodes,@VM,MSGPARMS$,99) ;* Added to pickup up additional parameters 10/03/2005 JCH BEGIN CASE CASE ErrCodes = 'STPROC' MText = ErrCodes MTitle = ErrCodes MIcon = '!' CASE ErrCodes = '' IF INDEX(MsgParms,@SVM,1) THEN MText = ErrCodes MTitle = ErrCodes END ELSE MText = MsgParms MTitle = 'Application Error Message' END MIcon = '!' CASE MsgID = 'FS414' TextLine = ErrCodes<2,1,2> TextLine := CRLF$:CRLF$ TextLine := 'This record is locked by THIS workstation.':CRLF$:CRLF$ TextLine := 'Check for minimized windows that have this record open and close the record.' TypeOver = '' TypeOver = TextLine TypeOVer = 450 Msg(@WINDOW,TypeOver,'LOCKS') RETURN CASE MsgID = 'FS415' TextLine = ErrCodes<2,1,2> TextLine := CRLF$:CRLF$ TextLine := 'This record is locked by ANOTHER workstation.':CRLF$:CRLF$ TextLine := 'Check other workstations for the open record.' TypeOver = '' TypeOver = TextLine TypeOVer = 450 Msg(@WINDOW,TypeOver,'LOCKS') RETURN CASE 1 * Passed in MsgID must be a system generated error message OSREAD Reverrors FROM 'REVERROR.DAT' THEN Pos = INDEX(Reverrors,MsgID,1) IF Pos THEN MText = Reverrors[Pos,CHAR(13)] MText = Field(MText,":",2) MText = Trim(MText) FOR I = 1 TO COUNT(MsgParms,@VM) + (MsgParms NE '') SWAP '%':I:'%' WITH MsgParms<1,I> IN MText NEXT I MText = Trim(MText) MTitle = 'System Error Message - ':MsgID MIcon = '!' END ELSE IF INDEX(MsgID,@SVM,1) THEN ;* Updated 2/5/2005 to work with system messages MText = FIELD(MsgID,@SVM,2) MTitle = FIELD(MsgID,@SVM,1) END ELSE MText = MsgID MTitle = 'Application Message' END MIcon = '!' END END ELSE MText = "OSREAD Error on file: REVERROR.DAT." MTitle = 'ERRMSG routine Error.' MIcon = 'H' END CASE 1 END CASE ErrDispLines := MTitle:@VM:MText:@FM ;* Added 1/20/2010 JCH /* * Display the message BEGIN CASE CASE Len(MText) < 20 ; Msg_Len = 200 CASE Len(MText) < 30 ; Msg_Len = 260 CASE Len(MText) < 40 ; Msg_Len = 320 CASE Len(MText) < 50 ; Msg_Len = 380 CASE Len(MText) < 60 ; Msg_Len = 440 CASE 1 ; Msg_Len = 450 END CASE TypeOver = '' TypeOver = MText TypeOver = 'BO' TypeOver = MIcon TypeOVer = Msg_Len TypeOver = 192:@VM:192:@VM:192 TypeOver = MTitle TypeOver = 'L' Msg('',TypeOver) */ NEXT M IF ErrCodeCnt = 1 AND MTitle = 'Application Message' OR MTitle = 'Process Error' THEN * Display the message BEGIN CASE CASE Len(MText) < 20 ; Msg_Len = 200 CASE Len(MText) < 30 ; Msg_Len = 260 CASE Len(MText) < 40 ; Msg_Len = 320 CASE Len(MText) < 50 ; Msg_Len = 380 CASE Len(MText) < 60 ; Msg_Len = 440 CASE 1 ; Msg_Len = 450 END CASE TypeOver = '' TypeOver = MText TypeOver = 'BO' TypeOver = MIcon TypeOVer = Msg_Len TypeOver = 192:@VM:192:@VM:192 TypeOver = MTitle TypeOver = 'L' Msg('',TypeOver) END ELSE CALL Set_Status(0) dummy = Create_Dialog('DIALOG_ERRMSG',@WINDOW,0,ErrDispLines) END RETURN