Focal Point
[SOLVED] Why is it discouraged to use -EXIT with Report Caster?

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

February 25, 2014, 03:50 AM
Wep5622
[SOLVED] Why is it discouraged to use -EXIT with Report Caster?
Recently we opened a case about a problematic Report Caster job and we got told to not use -EXIT in Report Caster, as it "stops all execution immediately" and to use -GOTO instead. The support desk referred us to an appendix in the RC documentation (http://documentation.informationbuilders.com/masterindex/html/html_wf_7705/wf77rcuser/wf77rcuser.pdf) that mentions several statements that we "should not use in Report Caster".

Furthermore, after asking about it some, I got explained that:
quote:

In most instances the -EXIT appears after the part of the fex that contains
the report to be distributed. Therefore, it will be distributed. Other
times it is not and the report may not be distributed. We have had customers
whose reports do not distribute. It depends up on where in the code it
appears.

-EXIT forces an exit from a procedure. However it does allow for execution
of stacked commands in the focstack. So even if the report commands are
executed and the report distributed, the tables may not update because
-EXIT stopped the execution from completing these last steps which occur
after the -EXIT. The information for -EXIT in the Core Language also
applies to WebFOCUS.


I am rather puzzled by these statements, as to me it appears that -EXIT is doing exactly what I would expect it to do: it stops execution and distributes all reports up to the statement.

Am I missing something here?
Why would IBI discourage using -EXIT (or -QUIT or FOC_NONE for that matter)?

This message has been edited. Last edited by: <Kathryn Henning>,


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 :
February 25, 2014, 04:16 PM
Waz
I think its is because the scheduled fex is wrapped in another fex that controls lots of things, so a -EXIT will just stop the processing.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 26, 2014, 02:50 AM
Dave
Waz,

sure, but WF isn't afraid to 'change' your code anyway.

If you have a fex with output format HTML. The ReportCaster still allows you to set it to distribute PDF. ( stop meddling WF! )

So they should be able to ignore the -EXIT too ( just jump to end of fex ).


_____________________
WF: 8.0.0.9 > going 8.2.0.5
February 26, 2014, 03:47 AM
Wep5622
Wouldn't -EXIT just exit the wrapped procedure and continue execution in the wrapping procedure? That's what I would expect to happen.

If this is indeed a problem (which I suspect it is, since IBI warns about not doing this), how many people actually knew about this?


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 :
February 26, 2014, 08:43 AM
j.gross
That's one of the differences between EX and -INCLUDE.

When alpha.fex invokes beta.fex via the EX command:
EX beta

a -EXIT in beta.fex will indeed return control to the next line in alpha.fex (or of the code from alpha.fex currently in FOCSTACK).

But when alpha.fex invokes beta.fex via the -INCLUDE dialog manager directive:
-INCLUDE beta

the contents of beta.fex are [I]inserted[I] into, and in effect become part of, alpha.fex -- so a -EXIT in beta.fex causes an immediate exit from alpha.fex.

The other major difference is that, with -INCLUDE, alpha.fex and beta.fex share the same 'address space" of amper variables, so the parameters received by or set in alpha.fex are automatically available to beta.fex (and conversely any set in beta.fex are available when control returns to alpha.fex); whereas, with EX, beta.fex operates in a separate, fresh amper variable "address space" (and that of alpha.fex is preserved across the invocation of beta.fex).

The need for the inner procedure to inherit the supplied parameters received by the wrapper is what dictated IBI's use of -INCLUDE in the wrapper; and that in turn occasions the restriction on -EXIT and -QUIT in the RCaster context.

This message has been edited. Last edited by: j.gross,


- Jack Gross
WF through 8.1.05
February 26, 2014, 03:57 PM
Waz
I would suggest that you only use -EXIT with testing.

I think its better to have the FEX gracefully finish than to just kill it.

e.g.
{code}
-IF {condition} THEN GOTO EOP ;
{code}
-EOP
-* End of Program



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

February 26, 2014, 04:50 PM
Gerry
In earlier releases the use of -QUIT and -EXIT in scheduled procedures sometimes disrupted ReportCaster processing and hence the documentation advising the use of branching logic to go to the end of a procedure and terminate gracefully. In WebFOCUS 7.7 and WebFOCUS 8 the processing is more robust. The documentation will be reviewed and revised accordingly.


WebFOCUS All Releases