Focal Point
[SOLVED] Asynchronous handling of server procedures: How to catch errors?

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3837099096

December 20, 2018, 10:37 AM
Wep5622
[SOLVED] Asynchronous handling of server procedures: How to catch errors?
I'm playing around with EX CMASAP, but I have a few questions.

Say, I have these procedures:
wrapper.fex:
-SET &ECHO = ON;
-TYPE Start of wrapper procedure

EX CMASAP REQ_NAME=wrapper_error, APPDIR=baseapp, CM_SETERR=ON, CM_ASYNC=OFF
-RUN

-TYPE End of wrapper procedure: &RETCODE


wrapper_error.fex:
TABLE FILE CART
PRINT CAR
BY COUNTRY
END
-RUN


You may have noticed the error in the2nd script. That's on purpose, as I am looking for a method to detect errors in the inner fex.

The kicker is, I don't want to rely on anything custom-made in the inner fex (wrapper_error).

I notice that generated flows use global variables, such as &&CM__RETURN, but I want my wrapper procedure to be fail-safe enough that even unexpected errors in wrapper_error get flagged.
I get the impression that &&CM_RETURN instead relies on setting it from within the wrapper_error fex?

Next, I would prefer to run this procedure asynchronously, BUT I do need some processing when the wrapped procedure completes.
Is that possible? Is there, for example, some kind of trigger or event that can be fired (with some context information from the wrapper fex) when wrapper_error completes?

The end goal is to wrap our ETL procedures in a parameterised fex that also logs (among other things) start and finish times and the return code of the ETL procedure.

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
December 20, 2018, 11:58 AM
Tony A
Hi Wep,

CMASAP is a DataMigrator process so you might be better off (a more knowledgable audience?) asking on the iWay Forum?

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 21, 2018, 08:40 AM
Tony A
Hi Wep,

This has been bugging me as I am sure that you should be able to capture it!

Try something like this in your wrapper.fex
-SET &ECHO = ON;
-DEFAULTH &&DEP_1_RC
-TYPE Start of wrapper procedure

EX CMASAP REQ_NAME=wrapper_error, APPDIR=baseapp, CM_SETERR=ON, CM_ASYNC=OFF, DEP_ALIAS=DEP_1
-RUN

-TYPE End of wrapper procedure: &&DEP_1_RC


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
December 21, 2018, 09:47 AM
Wep5622
Oh, indeed! That returns 8 for my faulty procedure and 0 for a proper one!
Good One

Now I wonder what RC=8 means... It's clearly not "FOC008: THE NUMBER OF IN-GROUPS-OF/IN-RANGES-OF FIELDS EXCEEDS 128", as I don't have any of those.

Perhaps it is this (DSTRUNER)?: https://infocenter.information...m#dAArcapiweb1037438

But even if it is... HTTP post error?!? I don't think so.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
December 21, 2018, 10:51 AM
Tony A
If memory serves, the RC is the &RETCODE from the REQ_NAME procedure. So, as an error during parsing of the procedure would return 8, this is what your RC=8 is inferring?

I'm sure Danny or Waz etc. will correct me if I'm remembering incorrectly Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10