Focal Point
ReportCaster-Scheduling&Parameters

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

March 02, 2007, 01:35 AM
<Torque>
ReportCaster-Scheduling&Parameters
Hi,

I have to run a report on every Monday and use the current date for some processing in the report. Here are my queries:
1. How do I pass the current system date to the
report? What parameter can be used incase i
use -DEFAULT command?
2. If the report is unable to run on the scheduled day(Monday), then it is required to run on the next available day but using the date of Monday itself. How do I achieve this?

Thanks!
March 02, 2007, 02:07 AM
FrankDutch
the first one is easy
there are a lot of amper variables that will give you the today date in several formats

see this
-SET &ENDDATE=DAMDY(&MDYY,'I8')+28;
-SET &ENDDATE=DTMDY(&ENDDATE,'I8');
-SET &ENDDATE=IF &ENDDATE.LENGTH EQ 7 THEN '0' | &ENDDATE;
-SET &ENDDATE=EDIT(&ENDDATE,'99/99/9999');
-TYPE &ENDDATE

(it comes from an other question here)

so the &MDYY will give you the todays date as a number.

this might help you for the second question too.
just look if it is still monday, if not go back 1, 2 , or more days...

will that help?

Frank




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

March 02, 2007, 02:36 AM
<Torque>
Thanks Frank,
I get the following output: 03/30/2007, when it should be 03/02/2007. But i guess thats manageable, by not using'+28' !!
The second query remains- would the caster be able to run the report if its run date has already passed. Does caster maintain some sort of queue, where the reports would be executed no matter what time they were scheduled to run?

Thanks in advance Smiler
March 02, 2007, 03:41 AM
FrankDutch
there are some other amper values like

&DATE
&YYMD
&MDY
&MDYY
etc...

the second question...I have an idea but need to test it first.




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

March 02, 2007, 07:39 AM
codermonkey
As I understand it Caster "wakes up" every minute to determine if there are any jobs that need to run. If it finds them it runs them. So if the server were down for whatever reason on a given day once the server was back up when Caster woke up it would run any jobs it find.

The problem with using system amper variables -- &YYMD -- is that they will supply the current system date, not the date you need for your report. We get around this by using parameter tables. Here's an example.

We store a process date of 03/05/2007. At run time, we pull the field, hold it, -READ it into an amper variable. The amper variable gets used in all the WHERE conditions. Once we've had a successful run, we update the field on the parm table to the next process date -- 3/12/2007, for example.

So regardless of when the report is kicked off, it will always pull everything since we last processed. Maybe a similar approach could work for you.
March 02, 2007, 09:38 AM
ira
Torque; Frank gave oyu some great &var's to work with. As for seeing if it is NOT a Monday? Use DOWK subroutine with system (current) date, and depending on the day of the week it returns have a conditional define or -set set up to subtract the number of days backwards to calculate the most recent Monday. Hope this helps..Ira


aix-533,websphere 5.1.1,apache-2.0,
wf 538(d), 537 (p),
==============
7.6.11 (t) aix 5312
websphere 6.1.19
apache 2.0
March 02, 2007, 07:41 PM
N.Selph
If Report Caster is not up, it will go back a number of days to pick up missed schedules based on the value put in "Scanback" in the Report Caster Config.

For reports that use the system date, but always should run on a Monday date, though, you can use the following logic.
-SET &WK_DT2_SD=DATECVT(&YYMD,'I8YYMD','YYMD');
-SET &MONDAY_SD=DATEMOV(&WK_DT2_SD,'BOW');
-SET &MONDAY=DATECVT(&MONDAY_SD,'YYMD','I8YYMD');



(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
March 03, 2007, 08:55 AM
FrankDutch
As far as I understood the second problem, it was not the point that the reportcaster is not up, but the data to be reported was not available.

do something with
-IF &RECORDS EQ 0 THEN GOTO NEXTDAY;
-* else run the report
-GOTO END
-NEXTDAY
-WRITE NEXTRUN &MONDAY
-EXIT

Start this report on reportcaster every day and check if it is either monday or if the file "NEXTRUN" exists.
If both conditions are -1 goto the end.
If it is monday, just run the program else...
If that file exists -READ the value &MONDAY and try to run the report again.
If the report is run succesfuly than kill that file and goto the end.

I did this kind of processes already in the DOS time, it must be possible to do it within webfocus too.


I hope it will work.

Frank




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

March 05, 2007, 05:27 AM
<Torque>
Thanks for all the responses. As I am new to this tool, just want to be absolutely sure.
I am describing my understanding below-

Suppose a report is scheduled using Report Caster (RC), such that it automatically runs every Monday. If RC is down on Monday, then RC would itself pick up the report from a 'queue' and run it, without any manual intervention.

Please correct me if anything here is wrong, as such a situation would be a little difficult to check practically, unless it actually happens itself.. and what if it doesnt run then..!!

Thanks Smiler
March 05, 2007, 12:50 PM
Kerry
Hi Torque,

Yes, this is correct. When ReportCaster comes back up, it will look for all records in the BOTSCHED table who’s NEXTRUNTIME field is less than the current date/time and ReportCaster will run it.

Hope this helps. Smiler

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
March 06, 2007, 02:04 AM
<Torque>
Thanks for all the help Smiler

Neha
March 07, 2007, 11:35 PM
<Torque>
Hi,

I have another query:

My report has to run from RC every Monday and the current date has to be used in processing. I am doing this using &YYMD presently. Now, consider a case when the server isnt able to run on the scheduled day. When it is up, say on Tuesday, when it would run my report, would &YYMD get me Monday's or Tuesday's date?
How can I achieve this if my current approach isnt correct?
Are there any variables that can be passed from RC and used as amper variables in the report?
Is there any documentation available about RC variables?

Thanks in advance.. Smiler
March 08, 2007, 12:46 PM
Darin Lee
Using the &YYMD variable would get you the date on which it actually runs - Tuesday in this case. You could create some other &var as noted previously that moves back to the previous Monday's date using DOWK and subtracting days or DATEMOV.
ReportCaster does have the ability to pass paramters to a procedure. You have to turn on the "Prompt for Parameters" property of the procedure. Then when you schedule the task, click on the "Advanced" button and enter the parameter values you want to pass. I don't know how this would apply to your situation as those values would change every time it runs, so I'm not sure this is what you're looking for.
Best solution would be to use -SET &vars at the beginning of the procedure to calculate a date that always falls on Monday last. Then you don't have to worry about what day it actually runs because it is always dated as of last Monday - or today if it runs on Monday like it should. (Now what happens when that Monday happens to be a national holiday? :-)


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat