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     [SOLVED] Decode not producing correct result

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Decode not producing correct result
 Login/Join
 
Gold member
posted
Hi,

I have the following code:

DEFINE FILE CAT
CONTACT/A40=EDIT(CATALPHABETIC,'9999999999999999999999999999999999999999');
END

TABLE FILE CAT
PRINT
CONTACT
BY CONSTANT AS SECTOR
IF CODE EQ BUS
IF NUM EQ 11
ON TABLE HOLD AS FCONTACT
END

DEFINE FILE TEMP
CONTACTNUMBER/A40 = DECODE SECTOR(FCONTACT ELSE ' ');
END

TABLE FILE TEMP
PRINT
SECTOR
CONTACTNUMBER
END
  


What this should produce a different set of number per sector so for example:
SECTOR CONTACTNUMBER
SECTOR1 TEL: 2222 222 2222 FAX: 2222 222 2222
But instead it produces:
SECTOR CONTACTNUMBER
SECTOR1 TEL:
So it seems to be truncating data for some odd reason.
Typically we have used the code below to correct this problem, but this code is not working either, I get a format error in the decode:



 
DEFINE FILE CAT
CONTACT/A40=EDIT(CATALPHABETIC,'9999999999999999999999999999999999999999');
QUOTE/A5=' '' ';
END

TABLE FILE CAT
PRINT
QUOTE
CONTACT
QUOTE
BY CONSTANT AS SECTOR
IF CODE EQ BUS
IF NUM EQ 11
ON TABLE HOLD AS FCONTACT
END
 


(FOC272) FORMAT ERROR IN DECODE OR FILE ELEMENT

Is there a certain way one needs to handle string data with spaces for use within a decode?

Thanks!

J.

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


7.6.11
Windows
HTML, PDF, Excel etc
DevStudio/Webfocus/Focus IBM
SQL Server 2000 / 2008
DB2
 
Posts: 78 | Location: UK | Registered: February 07, 2008Report This Post
Virtuoso
posted Hide Post
You should code as follows:
DEFINE FILE CAT
SKIP/A1 = ' ';
CONTACT/A42='''' | EDIT(CATALPHABETIC,'9999999999999999999999999999999999999999') | '''';
END
TABLE FILE CAT
PRINT SKIP CONTACT
BY CONSTANT AS SECTOR
IF CODE EQ BUS
IF NUM EQ 11
ON TABLE HOLD AS FCONTACT FORMAT ALPHA
END

DECODE requires values with embedded spaces to be embraced by single quotes.
If your field CONSTANT is also capable of holding spaces you should also provide code to encapsulate the values of CONSTANT in quotes. And, it may also be possible that your resulting hold file contains the fields without any spacing between them, so I put in an extra field (SKIP) to ensure at least one space is between the two fields.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Gold member
posted Hide Post
Perfect!

Thanks so much.

J.


7.6.11
Windows
HTML, PDF, Excel etc
DevStudio/Webfocus/Focus IBM
SQL Server 2000 / 2008
DB2
 
Posts: 78 | Location: UK | Registered: February 07, 2008Report 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     [SOLVED] Decode not producing correct result

Copyright © 1996-2020 Information Builders