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] Different behaviour than expected with CTRAN

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Different behaviour than expected with CTRAN
 Login/Join
 
Gold member
posted
I'm using CTRAN to replace a return (CR) and line feed (LF) with a null character.


 TABLE FILE MYTABLE
SUM
	COMPUTE CR/A2 = CTRAN(735, SENTENCE, 13, 0, CR);
	COMPUTE LF/A2 = CTRAN(735, SENTENCE, 10, 0, LF);
	COMPUTE TABLEDATA/A735 = '''' || REPLACE(SENTENCE, '''', '') || '''' ;
	COMPUTE TABLEDATA_NO_CR/A735 = REPLACE(TABLEDATA, CR, '');
	COMPUTE TABLEDATA_NO_LF_AND_CR/A735 = REPLACE(TABLEDATA, LF, ''); 
	BY SENTENCE NOPRINT
END
-RUN  



This code seems like it should work fine, but instead of replacing the characters I want, it replaces the first two letters of my sentence with a null character. I've tried to use the HEXBYT function, but got no results, so I figure that using this to get any result is better than none at all.

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


WebFOCUS 8.2.01M on Windows 10
 
Posts: 54 | Registered: July 30, 2018Report This Post
Virtuoso
posted Hide Post
If SENTENCE is an A735 field, you should change the format of CR and LF to A735 but if you're trying to create CR and LF fields you should try something like this:

  
CR/A1 = HEXBYT(13, 'A1');
LF/A1 = HEXBYT(10, 'A1');
CRLF/A2 = CR || LF;

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


WebFOCUS 8206, Unix, Windows
 
Posts: 1853 | Location: New York City | Registered: December 30, 2015Report This Post
Gold member
posted Hide Post
I'm computing them to make a variable to use. For some reason, there's an unwanted return and line feed character inside the sentence, so I'm computing both of them so I can use them inside the TABLEDATA_NO_CR and the TABLEDATA_NO_LF_AND_CR. From what I know, there's no way to call a replace on an ASCII character than by using CTRAN or HEXBYT to convert it into a character first, so I can call the variable in a REPLACE function later on.


WebFOCUS 8.2.01M on Windows 10
 
Posts: 54 | Registered: July 30, 2018Report This Post
Gold member
posted Hide Post
As mentioned before, I tried to use HEXBYT, but it doesn't seem to have any effect on the data. When I try to replace CRLF with something I can see, for example a '?' it doesn't show up where a CR/LF should be.


WebFOCUS 8.2.01M on Windows 10
 
Posts: 54 | Registered: July 30, 2018Report This Post
Master
posted Hide Post
-*
-* Function Name: REMOVECRLF
-* Purpose      : Take an A4000V alpha field and remove CRLF characters. Returns an A4000V.
-* Edit(s)      : 06/09/2015 - NBSP hex character now removed.
-*
DEFINE FUNCTION REMOVECRLF (IN4000/A4000V)
-* Remove 'apostrophe' characters.
 APOSSTRIPED/A4000V = STRREP(4000, IN4000,      2, (HEXBYT(146,'A1')), 1, '''', 4000, APOSSTRIPED);
-* Remove 'non-breaking space' characters.
 NBSPSTRIPED/A4000V = STRREP(4000, APOSSTRIPED, 2, (HEXBYT(160,'A1')), 1, ' ', 4000, NBSPSTRIPED);
-* Remove the CR.
 LINESTRIPED/A4000V = STRREP(4000, NBSPSTRIPED, 2, (HEXBYT(010,'A1')), 1, ' ', 4000, LINESTRIPED);
-* Remove the LF.
 REMOVECRLF/A4000V  = STRREP(4000, LINESTRIPED, 2, (HEXBYT(013,'A1')), 1, ' ', 4000, REMOVECRLF);
END  

Above is a DEFINE FUNCTION we use to clean up our text fields if/when required.

Sounds like you might want to look at the last two calcs?

This message has been edited. Last edited by: David Briars,
 
Posts: 822 | Registered: April 23, 2003Report This Post
Gold member
posted Hide Post
Thank you very much David, that worked perfectly.


WebFOCUS 8.2.01M on Windows 10
 
Posts: 54 | Registered: July 30, 2018Report 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] Different behaviour than expected with CTRAN

Copyright © 1996-2020 Information Builders