July 29, 2008, 12:07 PM
Tomsweb-INCLUDE RETURN CODE MESSAGES
I have created a driver fex that runs a stream of fexes for a monthly production run.
At this point, I have the following code:
-TYPE ___________________________________________________
-TYPE Starting Car1.fex: ( &BEG1 - &END1 ) FREQ = &FREQ
-RUN
-INCLUDE CAR1
-RUN
-TYPE Ending Car1 Fex: ( &BEG1 - &END1 ) FREQ = &FREQ
-TYPE ___________________________________________________
-RUN
-EXIT
-***********
However, if I remove the -RUN below the -INCLUDE car1.fex statement, I will see
this message when I click on view source:
___________________________________________________
Starting Car1.fex: ( 2008/07/01 - 2008/09/30 ) FREQ = Q
Ending Car1 Fex: ( 2008/07/01 - 2008/09/30 ) FREQ = Q
___________________________________________________
0 NUMBER OF RECORDS IN TABLE= 4 LINES= 4
Then if I put the -RUN back to follow the -INCLUDE CAR1 statement, I see this message:
Starting Car1.fex: ( 2008/07/01 - 2008/09/30 ) FREQ = Q
0 NUMBER OF RECORDS IN TABLE= 4 LINES= 4
Does anyone have any DM code that will effectively monitor that a called FEX is about to
start its run, and when it is complete, with the statistics - hopefully - displaying before a
message appears that it has completed?.
What about capturing a return code in the fex (at end) and passing that value back to
driver fex?
Thanks!
July 29, 2008, 12:17 PM
GinnyJakesTom,
You need the -RUN to force the execution of the code in car1.fex before you can type out a message saying that the fex is complete.
If you don't have the -RUN, all the DM commands run first before FOCSTACK is executed.
If you want to test a return code, &LINES is as good as any.
July 29, 2008, 12:55 PM
Leahquote:
Does anyone have any DM code that will effectively monitor that a called FEX is about to
start its run, and when it is complete, with the statistics - hopefully - displaying before a
message appears that it has completed?.
Where I worked previously, we allocated a file in a directory when the caster job ran and then did -WRITE commands to the file with various information. As Ginny indicates, for most control, the -RUN should be used. For our purposes we didn't use it often.
July 30, 2008, 04:23 AM
Danny-SRLTom,
Ginny gave you the "secret". When you run a WF procedure you have to be a bit schyzophrenic... or think "stereo".
Focexecs are read sequentially from line 1. If a line starts with a '-' it is executed immediately. If it doesn't, the line is written to the FOCSTACK. When either -RUN, -EXIT or last line is encountered, whatever has accumulated in the FOCSTACK is executed.
Hence, what you have observed.
As for testing "return codes" you have a choice:
&RECORDS (number of records extracted)
&LINES (number of lines generated)
&READS (number of records read from an external data source)
&BASEIO (number of I/O on a Focus db)
&FOCERRNUM (number of last error encountered - should be 0)
For efficiency, you can use &FOCCPU which shows the amount of CPU milliseconds. For example:
-* File ByTocXL.fex
-SET &START= &FOCCPU;
TABLE FILE CAR
SUM SALES
BY COUNTRY NOPRINT
BY CAR BY BODY
ON TABLE SET BYDISPLAY ON
ON TABLE HOLD FORMAT EXL2K BYTOC
END
-RUN
-SET &END= &FOCCPU;
-SET &USEDCPU=&END - &START;
-TYPE USED CPU = &USEDCPU
July 30, 2008, 09:28 AM
TomswebI tested your code exactly as provided with -RUN immediately after the Table Request.
-SET &ECHO=ALL;
-SET &START = &FOCCPU;
-TYPE START = &FOCCPU
-*
TABLE FILE CAR
SUM SALES
BY COUNTRY NOPRINT
BY CAR BY BODY
END
-RUN
-*
-SET &ENDZ = &FOCCPU;
-TYPE ENDZ = &FOCCPU
-SET &USEDCPU = (&ENDZ - &START);
-TYPE USED CPU = &USEDCPU
As the &ECHO display indicates, the &ENDZ and &USEDCPU are ignored: