Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] 2nd Friday of the every Month

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] 2nd Friday of the every Month
 Login/Join
 
Member
posted
Hi waz

Based on this code i'm trying to find out Second Friday of the Month

i'm getting Second Friday of the Month corretly for all the months a expect "June" month not correct

Could you please give me solution for this

DEFINE FUNCTION SCNDSAT/A8YYMD (SEEDDATE/A8YYMD)
SEEDYYMD/YYMD = SEEDDATE ;
CALC1/YYMD = DATEMOV(SEEDYYMD, 'BOM') ;
DOW/W = CALC1 ;
FIX/I1 = IF DOW EQ 7 THEN 7 ELSE 0 ;
CALC2/YYMD = CALC1 + (6 - DOW) + 7 + FIX ;
SCNDSAT/A8YYMD = CALC2;
END

-RUN

-SET &TESTDATE = '20130601' ;
-SET &RES = SCNDSAT(&TESTDATE) ;

-TYPE &TESTDATE - &RES



Thanks
kumar

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


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 7 | Registered: January 09, 2013Report This Post
Master
posted Hide Post
try using EOW instead of the calculation you have. It should simplify things.

DEFINE FUNCTION SCNDSAT/A8YYMD (SEEDDATE/A8YYMD)
SEEDYYMD/YYMD = SEEDDATE ;
CALC1/YYMD = DATEMOV(SEEDYYMD, 'BOM') ;
YYMDEOW/YYMD=DATEMOV(CALC1, 'EOW')  ;
CALC2/YYMD=YYMDEOW + 7;
SCNDSAT/A8YYMD = CALC2;
END

  

For me EOW gives me Friday.

If you wanted to, you could also condense the calculation into one line
CALC1/YYMD = DATEMOV(DATEMOV(SEEDYYMD, 'BOM') ,'EOW') +7


Thanks


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Expert
posted Hide Post
Changing the FIX line should do it.

FIX/I1 = IF DOW EQ 7 THEN 7 ELSE IF SEEDYYMD EQ CALC1 THEN 6 ELSE 0 ;


But I do like Eric's suggestion. even if the EOW moves to Saturday or Sunday, the calc is quite easy.


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!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Thanks waz for providing solution


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 7 | Registered: January 09, 2013Report This Post
Virtuoso
posted Hide Post
Elegant function which might be even better if you add 2 extra variables so you can also get the 3th Wednesday or the 4th Monday .
Or what about the last business day of the month.
(We have reports that need to be executed via reportcaster at the 4th business day of the month, something that would be a great improvement of the reportcaster schedule function)




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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
Member
posted Hide Post
Hi

with this code how to find 2nd sunday of the every Month

i'm new to webfocus

could you plese help me

quote:
Originally posted by eric.woerle:
try using EOW instead of the calculation you have. It should simplify things.

DEFINE FUNCTION SCNDSAT/A8YYMD (SEEDDATE/A8YYMD)
SEEDYYMD/YYMD = SEEDDATE ;
CALC1/YYMD = DATEMOV(SEEDYYMD, 'BOM') ;
YYMDEOW/YYMD=DATEMOV(CALC1, 'EOW')  ;
CALC2/YYMD=YYMDEOW + 7;
SCNDSAT/A8YYMD = CALC2;
END

  

For me EOW gives me Friday.

If you wanted to, you could also condense the calculation into one line
CALC1/YYMD = DATEMOV(DATEMOV(SEEDYYMD, 'BOM') ,'EOW') +7


Thanks


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 7 | Registered: January 09, 2013Report This Post
Master
posted Hide Post
Kumar,

In example 1, you want to adjust Calc2 to add or subtract the number of days between the day you are trying to find and the first friday of the month. In this case you are looking for the second sunday so that would 9 (sunday is 2 days after friday, and you want one week later)


quote:
Originally posted by kumar27:
DEFINE FUNCTION SCNDSAT/A8YYMD (SEEDDATE/A8YYMD)
SEEDYYMD/YYMD = SEEDDATE ;
CALC1/YYMD = DATEMOV(SEEDYYMD, 'BOM') ;
YYMDEOW/YYMD=DATEMOV(CALC1, 'EOW')  ;
CALC2/YYMD=YYMDEOW + 7;
SCNDSAT/A8YYMD = CALC2;
END

  


In example 2 you would do the same thing, only you adjust calc 1 by 9.

quote:
CALC1/YYMD = DATEMOV(DATEMOV(SEEDYYMD, 'BOM') ,'EOW') +7


Thanks


If this still doesn't make sense, try stepping through the logic. I find that breaking things apart helps me understand things better

Eric


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
 
Posts: 750 | Location: Warrenville, IL | Registered: January 08, 2013Report This Post
Expert
posted Hide Post
Frank, what you need can be accomplished with a preprocessing condition, a fex that decides if today is the 4th bd, and sets KILl_RPC to Y if its not. then schedule the job for the 4,5,6,7th of every month. not so elegant, but works. i do it that way.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Virtuoso
posted Hide Post
Yes susannah, that is how I do it..but the kill of rc gives me an error message and i want to avoid that.
The same issue comes in datamigrator .

I have a small proces that runs on the first day of the month five minutes after midnight.
It makes a list of the working day numbers skipping weekend and holidays. Now I can easy pick the 4th or 11th workday of the month, but still need to run that process several days a month.




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

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] 2nd Friday of the every Month

Copyright © 1996-2020 Information Builders