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]Left justifying a numeric field...

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[solved]Left justifying a numeric field...
 Login/Join
 
Guru
posted
I have 2 different fields that meant the same thing from 2 different applications:

FIELDNAME=CUSNO, ALIAS=CUSNO, USAGE=P9,ACTUAL=P5,TITLE='Customer,number', DESCRIPTION='Customer number', $
FIELDNAME=ENTITY, ALIAS=ENTITY, USAGE=A10, ACTUAL=A10,TITLE=Entity', DESCRIPTION='Entity', $

I need to match ENTITY field by dropping the last two digits, suppress the leading zeroes and left-justified the CUSTNO, but unable to get rid of the leading zeros:

ENTITY/A10 = LEFT-JUSTIFIED(SUPPRESS LEADING ZEROS(EDIT(CUSNO,'9999999$$')));


Please help! Thank you.


Hua

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


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Expert
posted Hide Post
I wouldn't use EDIT on a numeric column, I'm surprised it doesn't give you an error.

This is what I would do: Divide the numeric field by 100 with the result being put into an integer field to avoid rounding, then use the PTOA function to convert the integer field to an alpha field. With PTOA, there will be no leading zeros and the result will be left justified.

TABLE FILE CAR
PRINT 
WEIGHT
COMPUTE WEIGHTP/I8 = WEIGHT / 100;
COMPUTE WEIGHTA/A10 = PTOA(WEIGHTP, '(P8)', 'A10');
BY MODEL
END


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
Guru
posted Hide Post
Thank you, Francis.

PTOA is exactly what I need.
You are also right about the EDIT function.

Have a good evening!

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 2008Report This Post
Master
posted Hide Post
Hua,

The edit doesn't work on your numeric field because on the AS400 it is really a packed field. EDIT will convert your number to an alpha, but you would have to mask it in a second step. In this case Francis' recommendation is the way to go because it will replace the leading zeroes with leading spaces. Do a search on "Alphabetical List of Functions and Subroutines" and find the routines for your version.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes
 
Posts: 755 | Location: TX | Registered: September 25, 2007Report This Post
Guru
posted Hide Post
Pat,

Thank you for your explaination.
When I did my own search, "packed decimal" wasn't in my mind. I am still very much rely on the GUI to produce the codes, unfortunately, when I pulled down the Functions... inside the DEFINE box, I couldn't find PTOA function listed.
I am so glad to take advantage of the focal point. Thanks again to you and Francis for the quick responses.
Good day to everyone!

Hua


Developer Studio 7.6.11
AS400 - V5R4
HTML,PDF,XLS
 
Posts: 305 | Location: Winnipeg,MB | Registered: May 12, 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]Left justifying a numeric field...

Copyright © 1996-2020 Information Builders