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'm getting a FOC272 FORMAT ERROR IN DECODE OR FILE ELEMENT error when using a DECODE within an IF statement. The IF statement functions correctly if I replace the DECODE with a value.
DEFINE FILE CAR
CURNT_DT/YYMD = &YYMD;
CURNT_YR/YY=CURNT_DT;
CURNT_MT/M =CURNT_DT;
MTH_ID/A4 =
IF (CURNT_YR LE '2006') THEN
DECODE CURNT_MT(4 '0604' 10 '0610' ELSE '????') ELSE
DECODE CURNT_MT(3 '0703' 11 '0711' ELSE '????');
END
TABLE FILE CAR
PRINT
CAR
CURNT_DT
CURNT_YR
CURNT_MT
MTH_ID
END
What release are you on? The code you posted works in 7.6.9.
I suspect the restriction (in your release) relates to using a date variable as argument of DECODE (within an IF clause).
If you take the error message, "FORMAT ERROR IN DECODE OR FILE ELEMENT", literally, it is a complaint about a format mismatch within the DECODE (comparing "4" to the format of CURNT_MT/M) -- rather than a complaint about the presence of a DECODE within the IF clause, or mismatch between its resultant value and the LHS, MTH_ID/A4. The primary form for a literal value to be assigned to a date variable is a character literal (to be converted to the corresponding integer date-offset value), not the offset integer value.
What happens if you substitute a proper numeric variable: