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] TRIM Function adds Symbols

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] TRIM Function adds Symbols
 Login/Join
 
Member
posted
I am converting an integer to alpha format, and removing the leading zeros, but the TRIM function adds symbols to the results.

  
-SET &PAGES = 100;
FILEDEF TEMPPAGES DISK (APPEND
-RUN
-REPEAT PAGE_LOOP FOR &PCOUNTER FROM 1 TO &PAGES;
-WRITE TEMPPAGES NOCLOSE &PCOUNTER.EVAL
-PAGE_LOOP
-CLOSE TEMPPAGES
FILEDEF PMAS DISK TEMPPAGES.MAS
-RUN
-WRITE PMAS FILENAME=TEMPPAGES, SUFFIX=FIX    , $
-WRITE PMAS FIELDNAME=PAGES,ALIAS=, USAGE=I3, ACTUAL=A3 ,$
-CLOSE PMAS
-RUN
DEFINE FILE TEMPPAGES
PAGESALPHA/A6 = TRIM('L',EDIT(PAGES),6,'0',1,'A6');
END
TABLE FILE TEMPPAGES
PRINT
PAGES PAGESALPHA

WHERE PAGES GE 33;
END
-RUN



Starting at 33 the Euro symbols displays on some of the conversion. Other symbols also appear in the sample below:

PAGES PAGESALPHA
33 33 €
34 34
35 35 €
36 36
65 65 @
66 66 €
67 67 À


Any ideas what is going on?

Gary

This message has been edited. Last edited by: GaryB,
 
Posts: 29 | Location: Seattle Washington | Registered: July 08, 2009Report This Post
Expert
posted Hide Post
Change your DEFINE column to this:
PAGESALPHA/A6 = TRIM('L',EDIT(PAGES),3,'0',1,'A6');
The column is defined as I3 in the Master, so the TRIM should be using 3 characters as well.


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
Expert
posted Hide Post
1.Then don't do the DEFINE and TRIM; there aren't any Leading Zeroes anyway...
2. If you must have an alpha column, your TRIM code is incorrect, S/B A3 not A6:
DEFINE FILE TEMPPAGES
PAGESALPHA/A3 = TRIM('L',EDIT(PAGES),3,'0',1,'A3');
END


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Francis, change your A6 to A3, and, you beat me again...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
If he needs an A6 field he can have one, but with a three character TRIM function...


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
Expert
posted Hide Post
Actually, he just needs to change the Master, if the need is for an A6 column:

-WRITE PMAS FIELDNAME=PAGES,ALIAS=, USAGE=I6, ACTUAL=A6 ,$


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Expert
posted Hide Post
Gary, You could also use FTOA to convert the I3, combined with LJUST you could also left justify the text.

FILEDEF TEMPPAGES DISK (APPEND
-RUN
-REPEAT PAGE_LOOP FOR &PCOUNTER FROM 1 TO &PAGES ;
-WRITE TEMPPAGES NOCLOSE &PCOUNTER.EVAL
-PAGE_LOOP
-CLOSE TEMPPAGES
FILEDEF PMAS DISK TEMPPAGES.MAS
-RUN
-WRITE PMAS FILENAME=TEMPPAGES, SUFFIX=FIX    , $
-WRITE PMAS FIELDNAME=PAGES,ALIAS=, USAGE=I3, ACTUAL=A3 ,$
-CLOSE PMAS
-RUN
DEFINE FILE TEMPPAGES
PAGESALPHA/A6 = FTOA(PAGES,'(F3)','A6');
END
TABLE FILE TEMPPAGES
PRINT
PAGES PAGESALPHA

WHERE PAGES GE 33;
END
-RUN


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
<FreSte>
posted
Or use the FPRINT function.


COMPUTE AA/A3 = FPRINT(PAGES, 'I3', 'A3');

...

FPRINT: Converting Fields to Alphanumeric Format

Usage Notes for the FPRINT Function
The FPRINT function converts any type of field except for a text field to its alphanumeric
equivalent for display. The alphanumeric representation will include any display options that
are specified in the format of the original field.
Available Languages: reporting

FPRINT(infield, 'usageformat', outfield)
where:
infield     : Is the field to be converted.
usageformat : Is the usage format of the field to be converted, including display options. The format must be enclosed 
              in single quotation marks.
outfield    : Is the name of the output field or its format enclosed in single quotation marks. The
output field must be long enough to hold the converted number itself, with a sign and
decimal point, plus any additional characters generated by display options, such as
commas, a currency symbol, or a percent sign.

For example, D12.2 format is converted to A14 because it outputs two decimal digits,
a decimal point, a possible minus sign, up to eight integer digits, and two commas. If
the output format is not large enough, excess right-hand characters are truncated.

Usage Notes for the FPRINT Function
The output of FPRINT for numeric values is right-justified within the area required for the
maximum number of characters corresponding to the supplied format. This ensures that
all possible values are aligned vertically along the decimal point or units digit.
By default, the column title is left justified for alphanumeric fields. To right justify the
column title, use the /R reformatting option for the field.
 
Report This Post
Member
posted Hide Post
Thanks everyone.

Fixing the field lengths worked fine, but I have to say I liked FPRINT because it can be used in other conversions.

Gary
 
Posts: 29 | Location: Seattle Washington | Registered: July 08, 2009Report This Post
Expert
posted Hide Post
FPRINT - very interesting function. Can't find any documentation online, search at IBI Documentation results in "There were no results for fprint. Here are the results for print."

No documentation about it in the DevStudio 7.6.8 Help either.

Ah... it looks like a new feature in v7.7.

Nice.


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
<FreSte>
posted
Francis,

I know this was around in 7.6.9 (not sure about the other 7.6.x releases), but it was not documented.
For 7.7 it is documented, see here

-Fred-
 
Report This Post
Expert
posted Hide Post
Merci!


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
Expert
posted Hide Post
I just checked 7.6.6 and it had FPRINT.


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
I just checked 7.6.8 and it's available, but not documented.


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
Expert
posted Hide Post
I should have added, that I checked 7.6.9 and 7.6.11, and all had it.

Francis, your signature says you have 7.6.5, does it work on that version ?


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
  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] TRIM Function adds Symbols

Copyright © 1996-2020 Information Builders