[CLOSED] Capturing Correct Error No. with &FOCERRNUM
I am running a procedure that prompts for a variable and if the user enters the wrong format I get error code FOC006 followed by FOC009. I want to test only for FOC006 but the code below displays only 9 - the second of 2 errors.
TABLE FILE CAR PRINT SEG.MODEL BY COUNTRY BY CAR BY SEATS IF SEATS EQ '&SEATS.EVAL' END -RUN -TYPE WEBFOCUS ERROR NO. = &FOCERRNUM
ERROR AT OR NEAR LINE 5 IN PROCEDURE Procedure1.fexFOCEXEC * (FOC006) THE FORMAT OF THE TEST VALUE IS INCONSISTENT WITH FIELD FORMAT: xxx BYPASSING TO END OF COMMAND (FOC009) INCOMPLETE REQUEST STATEMENT WEBFOCUS ERROR NO. = 9This message has been edited. Last edited by: FP Mod Chuck,
_______________________ *** WebFOCUS 8.1.05M ***
December 07, 2018, 12:52 PM
BabakNYC
This might not apply to your specific use case but what if you checked for valid numbers instead so you don't even get an error?
-IF PATTERNS(&SEATS) NE 9 OR 99 THEN GOTO ERR_MSG
TABLE FILE CAR
PRINT SEG.MODEL
BY COUNTRY BY CAR BY SEATS
WHERE SEATS EQ &SEATS
END
-RUN
-EXIT
-ERR_MSG
-TYPE YOU ENTERED AN INVALID VALUE.
WebFOCUS 8206, Unix, Windows
December 08, 2018, 05:41 AM
Ian Dalton
Thanks for the suggestion but actually my prompted field is a date and I know I can check its syntax but was just wanting to capture the correct error number.
_______________________ *** WebFOCUS 8.1.05M ***
December 08, 2018, 11:42 AM
FP Mod Chuck
Ian
Unfortunately that variable is always the last error number that occurred even though it may not be the one you want to capture.
Thank you for using Focal Point!
Chuck Wolff - Focal Point Moderator WebFOCUS 7x and 8x, Windows, Linux All output Formats