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] Get the Day Of Week Number from MDYY Date

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Get the Day Of Week Number from MDYY Date
 Login/Join
 
Expert
posted
I have a bad case of brain freeze at the moment... Whould someone be so kind as to remind me how to get the DAY OF WEEK NUMBER (1-7) from a data in MDYY format...

Thanks a Meg or two...

This message has been edited. Last edited by: Doug,
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Convert MDYY to YYMD
   
DEFINE FILE WHATEVER
 ADATE1/YYMD   = '&DATEYYMD';
 IDATE1/I8YYMD = ADATE1;
 DATE_DAY/A4   = DOWK(IDATE1, DATE_DAY);


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Thanks Tom,

I'll DECODE the A3 Days into 1-7...

The Power of the Forum thaws out another one...

Doug
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Expert
posted Hide Post
Hey Doug,

There is a WEEKDAY function, don't remember the syntax, but, easier to DECODE, as you're doing..

Glad to help!

Tom


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
Given a "smart-date" field, you can isolate the day of week by simply assigning to a format W or WT field; and you can assign that directly to an I field to hold it as a plain integer, 1 to 7.

But bear in mind that Focus counts the days as Monday (1) through Sunday (7). For the day number relative to a Sunday-through-Saturday week, you have to add one day, and adjust with IMOD to keep the result in the desired 1-7 range.

Run this:
  
TABLE FILE CAR
  PRINT CAR NOPRINT
AND COMPUTE
  DATE/MDYY=IF DATE EQ 0 THEN '&DATEMDYY' ELSE DATE+1;

-* isolate day of week (internally 1 to 7, MON=1 ... SUN=7):
  W1/WT=DATE;
-* cast to integer: 
  W2/I8=W1;
-* adjust for SUN=1 thru SAT=7:
  W3/I8=IMOD(W2,7,'I3')+1;

END


- Jack Gross
WF through 8.1.05
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
Thanks Guys... I owe you meg or two...

Here's what I did:
-* DM: 
-SET &DATEIN = 20090912  ;
...
DEFINE FILE WhatEver
DATEA/I8YYMD = &DATEIN ;
DATEB/A4     = DOWK(DATEA, DATEB) ;
DATEC/I1     = DECODE DATEB(SUN 1 MON 2 TUE 3 WED 4 THU 5 FRI 6 SAT 7) ;
END
Not elegant... But, I'm under the gun here... It works... Smiler I'm happy... My headache is gone...
Thanks Again...
Doug




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
Could have done it like so:
-SET &DATEIN = 20090912  ;
...
DEFINE FILE WhatEver
DATEA/YYMD = '&DATEIN' ;
DATEB/W    = DATEA ;
END

Music


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report 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] Get the Day Of Week Number from MDYY Date

Copyright © 1996-2020 Information Builders