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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
DOWK function
 Login/Join
 
<Vanessa>
posted
Hi everyone,

I am very new to FOCUS and have very little experience with it. I need to do the following. Calculate an Expiry date which should equal to todays date + 1 day. If the Expiry date falls on a Saturday or Sunday then the Expiry date should be move to the following Monday. The expiry and Input date should be in the MDY format but I belive that for DOWK you have to use the YMD format
Here is my code:
COMPUTE
INP_DATE/MDYY = '&MDYY';
EXP_DATEA/YYMD = '&YYMD' + 1;
EXP_DATEX/MDYY = INP_DATE + 1;
EXP_DATEY/MDYY = INP_DATE + 2;
DAY/A4 = DOWK(EXP_DATEA,DAY); ADJ/A1 = DECODE DAY
(MON '1' TUE '1' WED '1' THU '1' FRI '1' SAT '2' SUN '1');
EXP_DATE/MDYY = IF ADJ EQ '2' THEN EXP_DATEY ELSE EXP_DATEX;

The Input Date is the system date. The problem is no matter on what day the expiry date falls I am always getting the expiry date as the input date + 1.

I would really appreciate if someone could tell me what I was doing wrong.

Thanks
 
Report This Post
Guru
posted Hide Post
Your DECODE doesn't have an ELSE, so you don't know if DAY is even being calculated right. I suspect it isn't. I don't think you can add integer dates the way you are doing it. &MDYY is an integer date, not a smart date.
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Expert
posted Hide Post
Vanessa, add 1 to the current date and then use the DATEMOV function to move the new date to the next week day.

-SET &ECHO=ALL;
-* CHOOSE A DATE TO TEST WITH
-*-SET &DATE1 = &YYMD;
-SET &DATE1 = 20051007;
-*
TABLE FILE CAR
PRINT
CAR
COMPUTE INP_DATEA/A8YYMD = '&DATE1'; NOPRINT
COMPUTE INP_DATE1/YYMD = INP_DATEA; NOPRINT
COMPUTE EXP_DATE1/YYMD = DATEMOV(INP_DATE1 + 1,'WD+'); NOPRINT
COMPUTE INP_DATE/MDYY = INP_DATE1;
COMPUTE EXP_DATE/MDYY = EXP_DATE1;
WHERE RECORDLIMIT EQ 1
END
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
<Vanessa>
posted
Thanks for the reply.

I did check if the DOWK funtion is working or not and you are right, it is not.

I put in a change to the code:
COMPUTE MYDAY/A3 = DOWK(EXP_DATEA,'A3');
COMPUTE ADJ/I1 = DECODE MYDAY
(' ' 5 'MON' 1 'TUE' 1 'WED' 1 'THU' 2 'FRI' 1 'SAT' 1 'SUN' 1);
COMPUTE EXP_DATE/MDYY = IF ADJ EQ 5 THEN EXP_DATEY ELSE EXP_DATEX;

Any ideas as to what I should change?

Thanks
 
Report This Post
<Vanessa>
posted
Hi Francis,

Thanks very much for your suggestion. It works just great.

Really appreciate the help
 
Report This Post
Guru
posted Hide Post
Vanessa-
You may also want to take a look at the 'business days' capability of WebFOCUS. Also check out the 'holiday' feature. Also look at WD (Weekday) in DATEADD.
You can search for these by using the 'Search the Technical Documentation Library' button in the upper right corner of this screen.
HTH
 
Posts: 252 | Location: USA | Registered: April 15, 2003Report This Post
Expert
posted Hide Post
Vanesa,

Welcome to the forum.

Cheers,

Francis.
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders