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
Help with Date.
 Login/Join
 
Platinum Member
posted
Hi,

I have a date that is defined in A8 format. I want to convert it to A8YYMD format to insert into DB2 date field. The following transform gives me a blank date when the OLD_DATE is invalid(i.e 20030431, 20040931 etc). I hav not control over the data.

NEW_DATE/A8YYMD = OLD_DATE

OLD_DATE is defined as A8. How do I move the date to end of month and convert it into A8YYMD format in one step.

Thanks.
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Virtuoso
posted Hide Post
Here is an "old school" way to do it. There are newer functions in FOCUS/WebFOCUS that probably do what would like to do in fewer steps but I think this will get the results you are looking for.

TABLE FILE CAR
PRINT RCOST DCOST
COMPUTE
ORG_DATE/A8='20050231';
FST_DATE/I6YYM=EDIT(EDIT(ORG_DATE,'999999')) + 1;
SEC_DATE/YYMD=FST_DATE;
NEW_DATE/YYMD=SEC_DATE-1;
BY COUNTRY
END
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Platinum Member
posted Hide Post
Hi. You can also try this:

TABLE FILE CAR
PRINT COUNTRY
COMPUTE
DTE_A/A8 = '20050526'; NOPRINT
COMPUTE
DTE_NEW/A8YYMD = DATECVT(DATEMOV(DATECVT(DTE_A, 'A8YYMD', 'YYMD'),
'EOM'), 'YYMD', 'A8YYMD');
WHERE RECORDLIMIT EQ 1
END
 
Posts: 118 | Location: DC | Registered: May 13, 2005Report This Post
Platinum Member
posted Hide Post
Hi,

All of your suggestions work. But I want to move the date to end of month only it is an invalid it. How do I check for that.

NEW_DATE/A8YYMD = OLD_DATE

I tried NEW_DATE = ' '
but it did not work.
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Platinum Member
posted Hide Post
Hi,

All of your suggestions work. But I want to move the date to end of month only if is an invalid date, like 20040931. How do I check for that.

NEW_DATE/A8YYMD = OLD_DATE

I tried NEW_DATE = ' '
but it did not work.
 
Posts: 176 | Location: Desplaines | Registered: August 05, 2004Report This Post
Platinum Member
posted Hide Post
Try this:
-*COMPUTE DTEA/A8 = '20050526'; NOPRINT
COMPUTE DTEA/A8 = '20050532'; NOPRINT
COMPUTE DTEB/A8 = EDIT(DTEA,'999999') | '01';
COMPUTE DTE_NEW/A8YYMD= IF (DATECVT(DTEA, 'A8YYMD', 'YYMD') EQ 0) THEN
DATECVT(DATEMOV(DATECVT(DTEB, 'A8YYMD', 'YYMD'),'EOM'),'YYMD', 'A8YYMD')
ELSE DTEA;
Couple things to note:
1) DATECVT returns zero when the dated tested is invalid so you can then test for the zero
2) the DTEB field is necessary because DATEMOV wants a valid date for input. So, you set the date to the first of the month then move it to the end via DATEMOV.

Hope this helps.
 
Posts: 118 | Location: DC | Registered: May 13, 2005Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders