My previous working day suddenly stopped working. I am using the following syntax over a month. -SET &PRIBUSDAY = DATEMOV(&YYMD, 'PWD'); it is setting to 20070908 instead of 20070910.
Thanks, SG.This message has been edited. Last edited by: Kerry,
Webfocus 7.6.8 PDF,HTML & EXCEL
September 11, 2007, 09:18 AM
Francis Mariani
I've been led to believe that Date functions will only work with Date fields, in Dialogue Manager &YYMD is an alphanumeric value, not a Date field. You can use Date functions in Dialogue Manager if you convert the date to a Date field before applying the function.
The inner DATECVT function converts &YMMD to a Date field, then DATEMOV is applied, then the outer DATECVT converts the result back to an alphanumeric field.
Ridiculous, non?
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
September 11, 2007, 09:30 AM
SG
Thank You Francis for the explanation and its working now.
SG.
Webfocus 7.6.8 PDF,HTML & EXCEL
April 29, 2009, 10:34 AM
mark66
Hi guys,
We have a problem with Previos Work Day calculation. I am using Francis's example to convert the text to date then doing DATEMOV etc.
This works fine, however someone has noticed that the previous working day calulcation for 1st Feb 2009 is Thursday 29th Jan and not Friday 30th Jan?
And similarly, 'NBD' returns the following Tuesday for a weekend argument date.
-- Apparently the DATECVT function first adjusts a non-business-day argument date in the indicated direction to a business day, and then continues to the adjusted argument date's prior or next business day.
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
April 30, 2009, 10:09 AM
Francis Mariani
Does anyone else think this is ridiculous?
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 30, 2009, 12:22 PM
j.gross
Let's just say it's disappointing that the functions were not properly QA'd.
Note that Patricia's work-around will fail if and when IBI fixes DATEMOV. Here's a safer workaround.
-* To compute &OUT = the weekday following &IN (both as simple +yyyymmdd integer values):
-SET &OUT1 = DATECVT( DATEMOV( DATECVT(&IN ,'I8YYMD','YYMD') ,'NWD') ,'YYMD','I8YYMD');
-SET &OUT2 = DATECVT( DATEMOV( DATECVT(&OUT1,'I8YYMD','YYMD') ,'PWD') ,'YYMD','I8YYMD');
-SET &OUT = IF (&OUT2 GT &IN) THEN &OUT2 ELSE &OUT1;
-* To compute &OUT = the weekday preceeding &IN:
-SET &OUT1 = DATECVT( DATEMOV( DATECVT(&IN ,'I8YYMD','YYMD') ,'PWD') ,'YYMD','I8YYMD');
-SET &OUT2 = DATECVT( DATEMOV( DATECVT(&OUT1,'I8YYMD','YYMD') ,'NWD') ,'YYMD','I8YYMD');
-SET &OUT = IF (&OUT2 LT &IN) THEN &OUT2 ELSE &OUT1;
&OUT1 is the weekday date returned by DATEMOV, and &OUT2 is its neighbor back in the direction of the original date. We test whether &OUT2 looks right (where it lies in relation to the input date): - If &OUT2 looks wrong, &OUT1 is the correct result; - If &OUT2 looks right, &OUT1 must have overshot the goal, and &OUT2 is the correct result.
- Jack Gross WF through 8.1.05
May 01, 2009, 10:51 AM
PBrightwell
quote:
Does anyone else think this is ridiculous?
Yes, it's why I write some of my own functions as -INCLUDES at least then I know how they will operate.
Pat WF 7.6.8, AIX, AS400, NT AS400 FOCUS, AIX FOCUS, Oracle, DB2, JDE, Lotus Notes
May 01, 2009, 11:26 AM
Glenda
And here we thought we were the only ones having problems. Here's our solution which also includes holidays since we were unable to get that to work either.
-SET &EDATE = IF &TOD GT 17.00.00 THEN AYMD(&YYMD, 1, 'I8YYMD') ELSE &YYMD;
DDATE/YYMD = &EDATE;
T1/MDYY=DDATE;
T3/I2=IF '&W1' EQ 'MON' THEN 3 ELSE 1;
T4/MDYY=T1-T3;
T5/I8YYMD=T4;
T6/I8=T5;
-*
-*Looks at previous day to determine if that day was a holiday
-*If so, force it to look at the most recent work day
-*
TDATEI/I8 = DECODE T6(20060102 20051230
20060414 20060413
20060529 20060526
20060704 20060703
20060904 20060901
20061123 20061122
20061124 20061122
20061225 20061222
20061226 20061222
20070707 20071229
20070406 20070405
20070528 20070525
20070704 20070703
20070903 20070831
20071122 20071121
20071123 20071121
20071224 20071221
20071225 20071221
20080101 20071231
20080321 20080320
20080526 20080523
20080704 20080703
20080901 20080829
20081127 20081126
20081128 20081126
20081225 20081224
20081226 20081224
20090101 20081231
20090410 20090409
20090525 20090522
20090703 20090702
20090907 20090904
20091126 20091125
20091127 20091125
20091224 20091223
20091225 20091223);
TDATE/I8 = IF TDATEI EQ 0 THEN T6 ELSE TDATEI;
It's great to be able think outside of the box!!!
Glenda
In FOCUS Since 1990 Production 8.2 Windows
May 03, 2009, 05:40 AM
Baillecl
Focus Community, You are not dead, yet "Don't you think it's ridiculous" "Nice to think out of the box" How nice to read, Real thanks. Cordially and Focusely. PS : When I learnt (and never mastered) APL, someone told me that you had turned into a langage when you came to feel as Natural, dirty tricks to reach your goal. I have some "Focuseries" that I particularly cherish Last : Come to think to the enormous amount of money that went around Year 2K. "Wasn't it ridiculous" or worse ?
Focus Mainframe 7.6.11 Dev Studio 7.6.11 and !!! PC Focus, Focus for OS/2, FFW Six, MSO