Focal Point
[SOLVED] Second Saturday of the Month

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

December 13, 2012, 04:53 AM
Deepu
[SOLVED] Second Saturday of the Month
Hi

how to find the "Second Saturday of the Month"

can any one help me plz

Thanks
Smiler

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


WebFOCUS 7.6
Windows, All Outputs
December 13, 2012, 06:04 AM
Ahamed Thaha
For 1st Week day-> WHERE &CDAY LE 7
For 2nd Week day-> WHERE &CDAY GE 8 AND &CDAY LE 14



-SET &ECHO=ALL;

-SET &CURDATE=&YYMD;
-SET &CDAY=EDIT(&CURDATE,'$$$$$$99');
-RUN

DEFINE FILE CAR
CDATE/I8YYMD=&CURDATE;
CWDAY/A4 = DOWK(CDATE, CWDAY);
END

TABLE FILE CAR
PRINT CDATE CWDAY
WHERE COUNTRY EQ 'ENGLAND'
WHERE CWDAY EQ 'SAT';
WHERE &CDAY GE 8 AND &CDAY LE 14
ON TABLE HOLD
END
-RUN

-SET &CNT=&LINES;
-SET &GOTO = IF &CNT GE 1 THEN ':yes' ELSE ':notyes';
-GOTO &GOTO

-:yes
-TYPE Second saturday
-GOTO :END

-:notyes
-TYPE Not Second saturday
-:END
-EXIT


7.7.03
December 13, 2012, 04:06 PM
Waz
It should be a simple calc to get the day of week for the first day of the month and add 1 week + x days to it.

Something like 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 = '20120101' ;
-SET &RES = SCNDSAT(&TESTDATE) ;

-TYPE &TESTDATE - &RES



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!

December 13, 2012, 06:08 PM
Edward Wolfgram
Try

-DEFAULTS &FIRSTMON=20121201                                     
DEFINE  FILE CAR                                                 
MYDATE/YYMD WITH COUNTRY = '&FIRSTMON' ;                         
DOW/I1 = MYDATE - (INT(MYDATE/7) * 7) ;                          
MYSAT2/YYMD = IF DOW LE 5 THEN MYDATE+12-DOW ELSE MYDATE+14+DOW ;
END                                                              
TABLE FILE CAR                                                   
PRINT MYDATE DOW MYSAT2                                          
IF RECORDLIMIT EQ 2                                              
END                                                              




e.g.

 
EX TEST FIRSTMON=20121201
 


for dec, 2012


IBI Development
December 14, 2012, 07:41 AM
Deepu
quote:
Originally posted by Waz:
It should be a simple calc to get the day of week for the first day of the month and add 1 week + x days to it.

Something like 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 = '20120101' ;
-SET &RES = SCNDSAT(&TESTDATE) ;

-TYPE &TESTDATE - &RES


Thanks waz
Its working fine
One need a information
how to find the last run date report time , I'm not using Report Caster ,I'm running report manually


WebFOCUS 7.6
Windows, All Outputs
December 16, 2012, 03:47 PM
Waz
The simplest way to get the previous run would be to capture then run date each time the report is run, save it to a DB, FOCUS or other, then just TABLE to get the date/time.

This has been posted before in the forum.


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!