Focal Point
[SOLVED] HDAY with DATEMOV(date, 'PBD')

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

March 16, 2014, 03:33 AM
FRA-Sarwar
[SOLVED] HDAY with DATEMOV(date, 'PBD')
Hi to all,

i have issue with HDAY and Prior business day.
it means if the as of date is 20140102/yyyymmdd
and the holiday is 20140101 so the prior business day should be 20131231. but i am getting 19001231 which is default date instead of 20131231. if as of date is 20140104 and my holiday list is 20140103 then i will get the corect prior business day 20140102. just the issue is with the first of January. my code is as the following
  
-SET &EdaConfPath = FGETENV(7,EDACONF,256,'A256');
-SET &EdaConfPath = TRUNCATE(&EdaConfPath);
-SET &EdaBin = &EdaConfPath |'\bin\';
-RUN

FILEDEF HDAY2000 DISK &&LOCATION|HOLIDAYS.TXT
-RUN
STATE &&LOCATION|HOLIDAYS.TXT
-RUN
-IF &RETCODE NE 0 GOTO NOHOLFIL;
WINNT COPY &&LOCATION|HOLIDAYS.TXT &EdaBin|HDAY2000.ERR
-RUN
SET HDAY = 2000
-RUN
-NOHOLFIL
SET BUSDAYS = _MTWTF_
-RUN

and the defination of Prior business day is:
ASOFDATE/YYMD  = '20140102';
PBD/YYMD       = DATEMOV(ASOFDATE, 'PBD');


how to get the prior business day for the starting year (20131231)?
Thanks,

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.67 & WebFOCUS 80 windows
March 16, 2014, 11:13 AM
j.gross
How is ASOFDATE declared, and how is its value assigned to it?
March 17, 2014, 12:12 AM
FRA-Sarwar
j.gross,

ASOFDATE/YYMD = '20140102';


WebFOCUS 7.67 & WebFOCUS 80 windows
March 17, 2014, 01:28 AM
FRA-Sarwar
thanks,

today i could solve the issue. it means the issue was with holidays.txt.

when i add the 20130101 as holiday in my holidays.txt then able to get the prior business day (20131231) for as of 20140102.

thanks Smiler


WebFOCUS 7.67 & WebFOCUS 80 windows
March 18, 2014, 08:46 PM
StuBouyer
A somewhat annoying limitation to the Holidays file is that you must have at least on entry for every year that you might check a date against. Otherwise you recieve a Zero value.

This is documented but very east to miss - from the Function Manaul on "specifying Holidays"

quote:
Each year for which data exists must be included. Calling a date function with a date
value outside the range of the holiday file returns a zero for business day requests


Cheers

Stu


WebFOCUS 8.2.03 (8.2.06 in testing)