Focal Point
[WORK AROUND] Proper use of KILL_RPC

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

March 09, 2016, 12:23 PM
jcannavo
[WORK AROUND] Proper use of KILL_RPC
Hello,

I've never setup a scheduled report with a pre-process, but this one in particular has a goofy schedule. They want it run only on the 7th business day of the month, so I've done my research and setup a pre-process FEX that includes the following code:

-SET &DT_Today = DATECVT(&YYMD,'I8YYMD','YYMD');
-SET &DT_Check_BD = DATEADD(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'BD',6);

-SET &&KILL_RPC = IF &DT_Today EQ &DT_Check_BD THEN 'N' ELSE 'Y';
-SET &&KILL_RPC_ERR=N;
 


I set this up as a pre-process to my main FEX in the scheduler, however when run the process doesn't get past this pre-process when I run it, I see the following in the log:
-Executing pre-rpc...
-Task error: IBFSException 32027: local error
-No report to distribute

When I run the pre-processing FEX on it's own with the addition of:
-TYPE DT_Today= &DT_Today;
-TYPE DT_Check_BD= &DT_Check_BD;
-TYPE KILL_RPC= &&KILL_RPC;
-TYPE KILL_RPC_ERR= &&KILL_RPC_ERR;
 


I see the proper date values set and KILL_RPC is properly set to N.

Am I missing something? In my research i've seen KILL_RPC used as single amper and double amper variables, and i've tried both with no difference in processing. The error isn't very descriptive and I really didn't find much searching the forum, and there aren't enough lines to try EXIT debugging. So I'm not really sure if I'm using KILL_RPC properly, or if perhaps I have something setup in the schedule incorrectly.

Any advice would be appreciated.

Thanks,
JC

This message has been edited. Last edited by: jcannavo,


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 09, 2016, 12:26 PM
jcannavo
Also, after posting this I realized I hadn't tried to remove the follwing to try and generate a better error:
-SET &&KILL_RPC_ERR=N;  


So I commented that out and the error is the same.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 09, 2016, 01:13 PM
SWES
Hi JC,

Please take a look at this previous post:
previous post

Not sure if it helps, but it might give you a clue.

Best,
SWES


WebFOCUS 8105m
Windows 7, All Outputs

Member of the Benelux Usergroup
March 09, 2016, 02:26 PM
jcannavo
Hello SWES,

Thanks for the reply. I looked at that post and tried to set the KILL_RPC without the "IF" statement and still no resolution, also tried the "NEXTSTEP" option you had given to no avail. The other part of that post looks to be the fact that it was a bug in 8.1.03 but seemingly fixed in 8.1.05 in which we are on.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 10, 2016, 08:15 AM
Mike in DeLand
I have a very similar problem - First I was unable to even set up a pre-process because when I clicked on the button to select a procedure, I got an error that it couldn't find the server. IBI's response to that was to just enter the procedure name manually, which I did. Then when I tried my schedule, it acted a lot like what you described (without the FOC error) - I even had all kinds of -TYPE statements in my code and nothing got written to the scheudule log.

I have a remote session scheduled with IBI today to get this resolved. If I can remember, I'll let you know what happens.


Webfocus 8
Windows, Linux
March 10, 2016, 09:06 AM
jcannavo
Hello Mike,

Thanks for the information. If you find anything out from IBI please let me know. Right now I've setup the schedule sans the pre-process and set it to run on the 9th of every month since that is more or less the correct business day in most months this year. But it would be really nice to actually have it scheduled properly.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 10, 2016, 09:23 AM
jgelona
I have several jobs that use a pre-processing fex to determine if the job is to run or not, one almost exactly like this one except it runs on the 3rd business day of the month and it runs just fine. Been working since WebFOCUS ver 5. Here's the pre-processing fex.
-*
-* Run job if the current date is the 3rd business day of the month
-*
-SET &&KILL_RPC_ERR=N;
-SET &RUNDT=DATECVT(DATEADD(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'BD',2),'YYMD','I8YYMD');
-IF &RUNDT EQ &YYMD THEN GOTO FINISHED;
-*
-SET &&KILL_RPC=Y;
-*
-FINISHED


Just for the record, in Dialogue Manager, in a -SET statement, I never use quotes on a string unless there are embedded spaces or special characters.

Also, if the RC job has multiple tasks, the pre-processing fex must be included in every task. Over a year ago I asked for a new && variable that when set to 'Y' would kill the current task and all following tasks. I think it is going to be in 8.2.

This message has been edited. Last edited by: jgelona,


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 10, 2016, 12:27 PM
jcannavo
Hello jgelona,

Thank you for the suggestion. I had seen many of your posts regarding this sort of topic and tried a few things. I just tried setting my pre-process exactly like you have it here:

-SET &&KILL_RPC_ERR=N;
-SET &DT_Today = DATECVT(&YYMD,'I8YYMD','YYMD');
-SET &DT_Check_BD = DATEADD(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'BD',7);

-IF &DT_Today EQ &DT_Check_BD THEN GOTO FINISHED;
-*
-SET &&KILL_RPC=Y;
-*
-FINISHED


Again, when I run this FEX on it's own the value of &&KILL_RPC does change when I alter the number of business days so I know the FEX is working properly. But when I run the schedule it hits that same 32027 error and never gets to the main FEX.

There is only one task on this schedule within RC. Run the main FEX, pending this pre-process.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 10, 2016, 02:15 PM
Mike in DeLand
Well, I just found out that my problem is a bug in 8.103, and it's fixed in 8.105. But your signature shows you on 8.105 already, so maybe your problem is different from mine.


Webfocus 8
Windows, Linux
March 10, 2016, 02:24 PM
jcannavo
Thanks for the update Mike. Good luck!


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 10, 2016, 02:49 PM
Tom Flynn
jcannavo,
Your code won't work anyway, here's output for September:

7th BD for September is 9-12-2016:

  
-SET &XYYMD = '20160912';
-SET &DATE_BOM = DATECVT(DATEMOV(DATECVT(&XYYMD,'I8YYMD','YYMD'),BOM), 'YYMD', 'I8YYMD');
-TYPE &DATE_BOM
-SET &DATE_PLUS_6 = DATECVT(DATEADD(DATECVT(&DATE_BOM,'I8YYMD','YYMD'),'BD',6), 'YYMD', 'I8YYMD');
-TYPE &DATE_PLUS_6
-SET &FLAG = IF &YYMD EQ &DATE_PLUS_6 THEN 'Y' ELSE 'N';
-TYPE &FLAG

Answer:

-SET &XYYMD = '20160912';
-SET &DATE_BOM = DATECVT(DATEMOV(DATECVT(20160912,'I8YYMD','YYMD'),BOM), 'YYMD', 'I8YYMD');
-TYPE &DATE_BOM
 20160901
-SET &DATE_PLUS_6 = DATECVT(DATEADD(DATECVT(20160901,'I8YYMD','YYMD'),'BD',6), 'YYMD', 'I8YYMD');
-TYPE &DATE_PLUS_6
 20160909
-SET &FLAG = IF 20160310 EQ 20160909 THEN 'Y' ELSE 'N';
-TYPE &FLAG
 N
-EXIT


Your Code generates:
  
-SET &XYYMD = '20160912';
-SET &DT_Today = DATECVT(&XYYMD.EVAL,'I8YYMD','YYMD');
-SET &DT_Check_BD = DATEADD(DATEMOV(DATECVT(&XYYMD.EVAL,'I8YYMD','YYMD'),'BOM'),'BD',6);
-TYPE &DT_Today
-TYPE &DT_Check_BD

Answer:

-SET &XYYMD = '20160912';
-SET &DT_Today = DATECVT(20160912,'I8YYMD','YYMD');
-SET &DT_Check_BD = DATEADD(DATEMOV(DATECVT(20160912,'I8YYMD','YYMD'),'BOM'),'BD',6);
-TYPE &DT_Today 
 42259
-TYPE &DT_Check_BD 
 42256
-EXIT


You need to fix your DM code, and, research Business Days and incorporate those rules; WebFOCUS doesn't know what BD's are. IBI basically excludes Sat/Sun as a default...

hth


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 10, 2016, 03:06 PM
jcannavo
Hello Tom,

Actually, yes WF does recognize "BD". Tooday is the 8th business day of this month. When I run my code for +6 BD:

 
-SET &DT_Check_BD = DATEADD(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'BD',6);
 


Output is:
DT_Today= 42073;
DT_Check_BD= 42072;
KILL_RPC= Y;
KILL_RPC_ERR= N;

When I run it for +7 BD
-SET &DT_Check_BD = DATEADD(DATEMOV(DATECVT(&YYMD,'I8YYMD','YYMD'),'BOM'),'BD',7);


Output is:
DT_Today= 42073;
DT_Check_BD= 42073;
KILL_RPC= N;
KILL_RPC_ERR= N;

Even going through the GUI in a define if you go through the DATEADD function process you have the option of selecting Business Days as the unit of measure.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 10, 2016, 03:19 PM
Tom Flynn
jcannavo,

1. The values are not dates
2. Explained IBI default is to exclude Sat/Sun
3. Won't work for July Sept Jan
4. Run your code for the above months

These months include Holidays, so, you need to incorporate a Holiday file. if not, then the IBI default of excluding Sat/Sun will work...

Good Luck!


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
March 10, 2016, 03:28 PM
jcannavo
Thanks for the clarification Tom, I think I misunderstood your first post.

I know the data I'm getting back isn't a date, rather it's a numeric representation of the date. That is easily fixed with a CVT, but even though it may not be formatted correctly my code is still comparing the dates in the format they are in and able to flip the KILL_RPC flag based upon proper inputs.

That's the main problem I'm running into and am looking into workarounds to fix.


JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7
March 11, 2016, 09:46 AM
jgelona
jcannavo,

Do you have a holiday file? If not, try creating one and see if that helps. We've had one forever, since before DATEADD and DATEDIF. According to the documentation:

Business day. When using the business day unit, DATEADD uses the BUSDAYS parameter setting and holiday file to determine which days are working days and disregards the rest. If Monday is not a working day, then one business day past Sunday is Tuesday. See Specifying Holidays for more information.

I don't know if the "and" means both are required but it might. Just something to try.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
March 11, 2016, 03:09 PM
jcannavo
Thanks for all the suggestions, but I just couldn't get it to work. Rather came up with a work around.

Instead of leveraging the kill switch, I'm using the same logic as earlier only now leveraging INCLUDES.

So I do the check for the business day, if the business day is the desired to send out the report then I include the FEX which runs the report, otherwise end. This also eliminates the need for the pre-process FEX.

-IF &DT_Today EQ &DT_Check_BD THEN GOTO FEX1 ELSE GOTO FEX2;

-TYPE DT_Today= &DT_Today;
-TYPE DT_Check_BD= &DT_Check_BD;


-FEX1
-INCLUDE IBFS:/WFC/Repository/TEST/myFEX.fex
-GOTO FEXEND

-FEX2
-*-INCLUDE IBFS:/WFC/Repository/TEST/Terminate.fex
-GOTO FEXEND

-FEXEND
END



JC
WebFOCUS Dev Studio / App Studio
8.2.01
Windows 7