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     [TIP] CTRAN without pain

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[TIP] CTRAN without pain
 Login/Join
 
Expert
posted
I thought I'd make a separate post about this.

You can use CTRAN without having to figure out the Hex value (which is different for ASCII and EBCDIC) by incorporating the BYTVAL function into the code:

Original syntax:
CTRAN(charlen, string, decimal, decvalue, outfield);

BYTVAL(character, outfield);

Adapted syntax:
CTRAN(charlen, string, BYTVAL('from','I3'), BYTVAL('to','I3'), outfield);

e.g.:
-*-- Convert Apostrophe to Right Single Quotation Mark -------------------------
-SET &OBJ_NAME4 = CTRAN(&OBJ_NAME.LENGTH, &OBJ_NAME, BYTVAL('''','I3'), BYTVAL('’','I3'), 'A&OBJ_NAME.LENGTH');
-*-- Convert Slash and Dash to blank -------------------------------------------
RGN1/A50 = CTRAN(50, RGN0, BYTVAL('/','I2'), BYTVAL(' ','I2'), 'A50');
RGN2/A50 = CTRAN(50, RGN1, BYTVAL('-','I2'), BYTVAL(' ','I2'), 'A50');

You never have to look for an ASCII or EBCDIC chart again!


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
Very nice indeed Francis. I'll make sure to take note of the tip (a bookmark on this topic would be better, of course Wink )

- Neftali.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Expert
posted Hide Post
That is great. Cross Platform.

The only issue is when you want to CTRAN a non printable.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Expert
posted Hide Post
It's not an issue - you can use CTRAN in it's usual form for that.


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
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Master
posted Hide Post
I think Waz's point is that with non-printable characters you still have to look up the code in and ASCII or EBCDIC manual (unless you have them memorized).

This is a great tip. Probably why I never thought of it. Smiler


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
 
Posts: 975 | Location: Oklahoma City | Registered: October 27, 2006Report This Post
Virtuoso
posted Hide Post
Interesting that HEXBYT behaves properly even when the fex source is in Unicode.

Apparently 16-bit Unicode source is mapped to 8-bit (ASCII) coding before dialog manager sees it, and that's how the Focus code is placed in FOCSTACK for execution.

-- But what does the mapping do with non-Latin Unicode values?
 
Posts: 1925 | Location: NYC | In FOCUS since 1983 | Registered: January 11, 2005Report This Post
Expert
posted Hide Post
quote:
It's not an issue - you can use CTRAN in it's usual form for that.

I was only pointing out that if you wanted to CTRAN a character to, say, a carriage return, you would have to go with the number.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Thanks for the tip...Francis Smiler


WebFOCUS 7.6.4,7.6.9
OS: Windows XP
HTML,EXCEL,PDF
 
Posts: 18 | Registered: September 01, 2008Report This Post
Gold member
posted Hide Post
Bonjour Francis,

I have a field in a table which contains this value : "100-130-150-200-250 €".
In excel the field appears as "100-130-150-200-250 ¤" (euro sign is not converted properly).
How can I use your example to keep the euro sign in excel ?

Thanks for your help.
Catherine


7.7.02 (Html, Excel, Ahtml, Pdf,Graph,.....)
OS400 V5R3, V5R4
Windows 2000/2003/2007/2010
 
Posts: 68 | Location: France | Registered: February 27, 2008Report This Post
Guru
posted Hide Post
That is probably related to your NLS values. There have been other recent posts on that.


(Prod: WebFOCUS 7.7.03: Win 2008 & AIX hub/Servlet Mode; sub: AS/400 JDE; mostly Self Serve; DBs: Oracle, JDE, SQLServer; various output formats)
 
Posts: 391 | Location: California | Registered: April 14, 2003Report This Post
Virtuoso
posted Hide Post
Cati
is this field always in the same format?
numbers and dash at the same place?

If i would suggest some other solution

something like

NEWFORMAT1/A15=EDIT(OLDFIELD,'999$999$999$999$999$$');
-* this wil give you the string without dashes and valuta code
NEWFORMAT2/D15=EDIT(NEWFORMAT1);


now your newformat2 field is a number and you can present it with any valuta code, and that might work in excel as it should (although the NLS remark might still be important)




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

 
Posts: 2387 | Location: Amsterdam, the Netherlands | Registered: December 03, 2006Report 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     [TIP] CTRAN without pain

Copyright © 1996-2020 Information Builders