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.
Thank you Francis for the rapid reply. I see what your code is doing; however, there are 4 'separate' date fields in the dataset. That is, the dates are not contained in a single field so the HIGHEST syntax would not work.
Unless I am missing something in your example?
FOCUS 7.3.4 on Z/OS WebFOCUS/EDA 7.1.8 self-service - Win2003 and Z/OS
I was misled by your example, you showed multiple rows of data.
To determine the maximum value within multiple columns of a single row, try MAX():
MAX_DATE/YYMD = MAX(DATE1, DATE2, DATE3, DATE4);
MAX_CODE/A10 =
IF DATE1 EQ MAX_DATE THEN CODE1 ELSE
IF DATE2 EQ MAX_DATE THEN CODE2 ELSE
IF DATE3 EQ MAX_DATE THEN CODE3 ELSE CODE4;
Hopefully this helps a little.
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
-SET SEEDDATE = 20071101;
DEFINE FILE ...
MAXDATE1/MDYY = IF DATE1 LE &SEEDDATE AND DATE1 GT LAST MAXDATE1 THEN DATE1 ELSE LAST MAXDATE1;
MAXDATE2/MDYY = IF DATE2 LE &SEEDDATE AND DATE2 GT LAST MAXDATE2 THEN DATE2 ELSE LAST MAXDATE2;
MAXDATE3/MDYY = IF DATE3 LE &SEEDDATE AND DATE3 GT LAST MAXDATE3 THEN DATE3 ELSE LAST MAXDATE3;
MAXDATE4/MDYY = IF DATE4 LE &SEEDDATE AND DATE4
GT LAST MAXDATE4 THEN DATE4 ELSE LAST MAXDATE4;
MAXDATE0/MDYY = IF MAXDATE1 GT MAXDATE2 AND MAXDATE1 GT MAXDATE3 AND MAXDATE1 GT MAXDATE4 THEN MAXDATE1
ELSE IF MAXDATE2 GT MAXDATE1 AND MAXDATE2 GT MAXDATE3 AND MAXDATE2 GT MAXDATE4 THEN MAXDATE2
ELSE IF MAXDATE3 GT MAXDATE1 AND MAXDATE3 GT MAXDATE2 AND MAXDATE3 GT MAXDATE4 THEN MAXDATE3
ELSE MAXDATE4;
END
TABLE FILE ....
PRINT MAXDATE0
BY HIGHEST 1 MAXDATE0
END
Tex Hope this helps or gives you some idea of what to do.
Other than having to change the DATE fields into numerics, it worked like a dream.
I use MAX all of the time; however, I never thought of using it the way you recommended.
I had started coding something similar to TexasStingray's recommendation; however, I did not want to have to explain it to the user or to have to support the code.
I too have learned a new trick.
My thanks to both of you.
Harry
FOCUS 7.3.4 on Z/OS WebFOCUS/EDA 7.1.8 self-service - Win2003 and Z/OS
Nothing like having a redefinition of logic after you got something working ...
Rather than MAX, I have to determine the MAX and look for a tie. That is, if two of date fields are the same (for the most recent date prior to the seed date), I have to enter the value of 'checked'.
So, this code will not work:
COMPUTE MAX_CODE/A10 = IF DATE1 EQ MAX_DATE THEN PREV_U_CODE1 ELSE IF DATE2 EQ MAX_DATE THEN PREV_U_CODE2 ELSE IF DATE3 EQ MAX_DATE THEN PREV_U_CODE3 ELSE PREV_U_CODE4;
Is there an easy way to sort the values of the 4 'separate' date fields and then do LAST logic?
Other than hammer and pound, I am not seeing an easy way.
Any ideas?
Thanks
FOCUS 7.3.4 on Z/OS WebFOCUS/EDA 7.1.8 self-service - Win2003 and Z/OS