Kbase P33564: CONNECT NO-ERROR displays error message and program stops
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  04/01/2008 |
|
Status: Unverified
SYMPTOM(s):
Program stops execution when connect statement fails
CONNECT NO-ERROR does not prevent error messages from being displayed
CAUSE:
The reason why the NO-ERROR does not prevent the error message from appearing is because the system raises a stop condition and not just an error. The stop condition causes the program to terminate.
FIX:
The code sample below allows the program to continue executing after the connection fails. Also, the OUTPUT statement can be used to redirect the (437) error messages to a file so the user won't see them.
i.e. assuming sports database is running in multi-user mode using port 29000
DO ON STOP UNDO,NEXT:
OUTPUT TO "out.txt" KEEP-MESSAGES.
CONNECT -db sports1 -S 29000 -N tcp NO-ERROR.
END.
OUTPUT CLOSE.
if not connected("sports") then MESSAGE "You are NOT connected" VIEW-AS
ALERT-BOX.
MESSAGE "finishing..." VIEW-AS ALERT-BOX.
The above connect statement fails because the database name is wrong. However, the two following message statement are displayed.