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.
I have a datafile that contians dates in alphaformat, ,arranged as so: 20082 (Contains only the current year and a number representing a particular quarter of the year). How might I convert that date to a numeric calendar format?
I'm running mainframe FOCUS Release 7.1, which is awfully arcaic, but I work for an educational organization and can only work with what tools I am given.
Thanks in advance!This message has been edited. Last edited by: Kerry,
This is a very easy task for Maintain. Your code could look like this:
MAINTAIN COMPUTE X/A10 = '20082'; COMPUTE Y/A4 = SUBSTR(X, 1, 4); COMPUTE Z/A1 = SUBSTR(X, 5, 1); COMPUTE Z1/A4; IF Z = 1 THEN COMPUTE Z1 = '0101'; IF Z = 2 THEN COMPUTE Z1 = '0401'; IF Z = 3 THEN COMPUTE Z1 = '0701'; IF Z = 4 THEN COMPUTE Z1 = '1001'; COMPUTE X2/MDYY= Z1 || Y; TYPE "X2 = <END
Here I am just computing X to a value, but you could load the data into a stack and do a loop. I get the year and the quarter, and just compute them to a standard MDYY assuming standard starting dates of quarters.
If you need help loading the data or creating the loop, post the Master. Of course, the format of X2 can be an alpha or any other date format.
Mark
Posts: 663 | Location: New York | Registered: May 08, 2003
DEFINE FILE CAR
DT_YQ/A5 WITH COUNTRY =
IF COUNTRY EQ 'ENGLAND' THEN '20091' ELSE
IF COUNTRY EQ 'FRANCE' THEN '20042' ELSE
IF COUNTRY EQ 'ITALY' THEN '20083' ELSE '20044';
DATE1/A8 =
IF EDIT(DT_YQ,'$$$$9') EQ '1' THEN EDIT(DT_YQ,'9999$') || '0101' ELSE
IF EDIT(DT_YQ,'$$$$9') EQ '2' THEN EDIT(DT_YQ,'9999$') || '0401' ELSE
IF EDIT(DT_YQ,'$$$$9') EQ '3' THEN EDIT(DT_YQ,'9999$') || '0701' ELSE
IF EDIT(DT_YQ,'$$$$9') EQ '4' THEN EDIT(DT_YQ,'9999$') || '1001' ELSE '0';
DATE2/I8 = EDIT(DATE1);
END
TABLE FILE CAR
PRINT DATE2
END
You can further convert DATE2 to a Date format or a Date-Time format field.
(
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
Thank you for your fast replies! I think I suffered from brain loss earlier, and I appreciate your helping out. I'm incorporating your suggestions and think I will get this fixed very soon.
If you could define the incoming string as a legacy date field with YY and Q components, you could transform the legacy date to a 'smart' date by direct assignment. But the Q option was never incorporated in the legacy formats, so you have to make do with year+month formats.
Isolate the year and quarter, compute a month in the quarter, construct a legacy year+month date, and assign that to a year+quarter date: EX -LINES 5 EDAPUT MASTER,DATES,CV,FILE FILENAME=DATES, SUFFIX=FIX,$ SEGNAME=DATES, $ FIELD=DATE1 ,ALIAS=,A5 ,A5 ,$ FIELD=IGNORE ,ALIAS=,A75 ,A75 ,$
EX -LINES 5 EDAPUT FOCTEMP,DATES,CV,FILE 20001 20012 20023 20034
FILEDEF DATES DISK DATES.FTM DEFINE FILE DATES
AQ /A1=EDIT(DATE1,'$$$$9');
AM /A2=DECODE AQ( 1 '03', 2 '06', 3 '09', ELSE '12');
AYYM /A6YYM=EDIT(DATE1,'9999') | AM;
YYQ /YY-Q=AYYM;
END TABLEF FILE DATES LIST DATE1 AQ AM AYYM YYQ END
- Jack Gross WF through 8.1.05
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005