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     [CLOSED] define function for 7.7.03

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] define function for 7.7.03
 Login/Join
 
Silver Member
posted
We seem to have a problem using DEFINE FUNCTION with dates in 7.7.03. This same function works perfectly well in 7.6.4:

-DEFAULT &ECHO=ALL
DEFINE FUNCTION UDATEADD(INDATE/A8YYMD, INUNIT/A2, INNBR/I4)
INDATE1/YYMD    = INDATE;
UDATEADD1/YYMD  = DATEADD(INDATE1, INUNIT, INNBR);
UDATEADD/A8YYMD = UDATEADD1;
END
-RUN
DEFINE FILE CAR
ENDDATE_A10/A10 = EDIT(UDATEADD(EDIT('2012/03/20','9999$99$99'), 'D', 1),'9999/99/99');
END
TABLE FILE CAR
PRINT ENDDATE_A10
BY COUNTRY
WHERE RECORDLIMIT EQ 1;
END


7.6.4 Result:
PAGE 1

COUNTRY ENDDATE_A10
ENGLAND 2012/03/21


7.7.3 Result:
PAGE 1

COUNTRY ENDDATE_A10
ENGLAND 2 / /


Now, if we take the same exact date manipulation out of the DEFINE FUNCTION and move it into the DEFINE FILE, it works perfectly in 7.7.3:

-DEFAULT &ECHO=ALL
DEFINE FILE CAR
INDATE/A8YYMD = '20120320';
INUNIT/A2 = 'D';
INNBR/I4 = 1;
INDATE1/YYMD    = INDATE;
UDATEADD1/YYMD  = DATEADD(INDATE1, INUNIT, INNBR);
UDATEADD/A8YYMD = UDATEADD1;
ENDDATE_A10/A10 = EDIT(UDATEADD,'9999/99/99');
END
TABLE FILE CAR
PRINT ENDDATE_A10
BY COUNTRY
WHERE RECORDLIMIT EQ 1;
END


7.7.3 Result:
PAGE 1

COUNTRY ENDDATE_A10
ENGLAND 2012/03/21

Does anybody know what the problem is with DEFINE FUNCTION in 7.7.03?

This message has been edited. Last edited by: Kerry,


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 29 | Registered: February 21, 2011Report This Post
Virtuoso
posted Hide Post
Note that, in your code that "works perfectly in 7.7.3"
INUNIT/A2 = 'D';

pads the one-character literal 'D' with trailing blanks, in the process of assigning it to a 'longer' character variable.

It occurs to me that, in your DEFINE FUNCTION code, maybe in 7.7 the literal 'D' is stored as a full-word blank-padded value, so your formal argument INUNIT/A2 receives an unpredictable value, such as 'D@'.

See what happens if you change that 'D' to 'D '.

This message has been edited. Last edited by: j.gross,
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Silver Member
posted Hide Post
I found out that the problem is in the EDIT function! I took out the dates and just used plain text 'THISDATE'... just to eliminate the possibility of date processing causing problems.

-DEFAULT &ECHO=ALL
DEFINE FUNCTION UDATEADD(INDATE/A8)
UDATEADD/A8 = INDATE;
END
-RUN
 
DEFINE FILE CAR
ENDDATE_A10/A8=UDATEADD('THISDATE');
END
TABLE FILE CAR
PRINT ENDDATE_A10
BY COUNTRY
WHERE RECORDLIMIT EQ 1;
END


7.7.3 result:
PAGE 1

COUNTRY ENDDATE_A10
ENGLAND THISDATE


-DEFAULT &ECHO=ALL
DEFINE FUNCTION UDATEADD(INDATE/A8)
UDATEADD/A8 = INDATE;
END
-RUN
 
DEFINE FILE CAR
ENDDATE_A10/A10=EDIT(UDATEADD('THISDATE'),'9999/99/99');
END
TABLE FILE CAR
PRINT ENDDATE_A10
BY COUNTRY
WHERE RECORDLIMIT EQ 1;
END


Result in 7.7.3:
PAGE 1

COUNTRY ENDDATE_A10
ENGLAND T / /

I have too many fexes that use this function in this manner. Any ideas on a patch or something that fixes this?


WebFOCUS 7.6
Windows, All Outputs
 
Posts: 29 | Registered: February 21, 2011Report This Post
Virtuoso
posted Hide Post
The function seems to be working fine. It's the direct EDIT of the function output in the DEFINE FILE that seems to break. You should probably open a case with IBI. A work-around is to split the DEFINE FILE into two steps:

-DEFAULT &ECHO=ALL
DEFINE FUNCTION UDATEADD(INDATE/A8YYMD, INUNIT/A2, INNBR/I4)
INDATE1/YYMD    = INDATE;
UDATEADD1/YYMD  = DATEADD(INDATE1, INUNIT, INNBR);
UDATEADD/A8YYMD = UDATEADD1;
END
-RUN
-*
DEFINE FILE CAR
ENDDATE_A8/A8YYMD = UDATEADD(EDIT('2012/03/20','9999$99$99'), 'D', 1);
ENDDATE_A10/A10   = EDIT(ENDDATE_A8,'9999/99/99');
END
-*
TABLE FILE CAR
PRINT ENDDATE_A10
BY COUNTRY
WHERE RECORDLIMIT EQ 1;
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Virtuoso
posted Hide Post
Or ... put the final output EDIT in the function itself:

DEFINE FUNCTION UDATEADD(INDATE/A8YYMD, INUNIT/A2, INNBR/I4)
INDATE1/YYMD    = INDATE;
UDATEADD1/YYMD  = DATEADD(INDATE1, INUNIT, INNBR);
UDATE_A8/A8YYMD = UDATEADD1;
UDATEADD/A10    = EDIT(UDATE_A8,'9999/99/99');
END
-RUN
-*
DEFINE FILE CAR
ENDDATE_A10/A10 = UDATEADD(EDIT('2012/03/20','9999$99$99'), 'D', 1);
END
-*
TABLE FILE CAR
PRINT ENDDATE_A10
BY COUNTRY
WHERE RECORDLIMIT EQ 1 ;
END


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 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     [CLOSED] define function for 7.7.03

Copyright © 1996-2020 Information Builders