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] Converting and shortening an integer to alphanumeric

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Converting and shortening an integer to alphanumeric
 Login/Join
 
Member
posted
I need to convert an I11 format number to a 6 character string (even though the format is I11, all the fields are 6 characters).

I tried this:


DEFINE FILE PRIMARY
BAT_ID1/A6=FTOA(BAT_ID, '(I11)', BAT_ID1);
END
TABLE FILE PRIMARY
PRINT BAT_ID
BAT_ID1
END

And got this:

PAGE 1

BAT_ID BAT_ID1
168403 ******
170206 ******
170206 ******
171520 ******


If I change the BAT_ID1 field to A11, I get 11 *

Any Suggestions?


Thanks,
carl

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


Carl

FOCUS 7.1.6 on Windows XP
Output: Excel, HTML, PDF
 
Posts: 27 | Registered: October 19, 2007Report This Post
Expert
posted Hide Post
PTOA - Doesn't matter if it's an I,P,D...

BAT_ID1/A11=PTOA(BAT_ID, '(P11)', BAT_ID1);

  
APP PREPENDPATH IBISAMP
-RUN 
DEFINE FILE GGSALES
  ALPHA_UNITS/A8      = PTOA(UNITS,      '(P8)', ALPHA_UNITS);
  ALPHA_DOLLARS/A8    = PTOA(DOLLARS,    '(P8)', ALPHA_DOLLARS);
  ALPHA_BUDUNITS/A8   = PTOA(BUDUNITS,   '(P8)', ALPHA_BUDUNITS);
  ALPHA_BUDDOLLARS/A8 = PTOA(BUDDOLLARS, '(P8)', ALPHA_BUDDOLLARS);
END
TABLE FILE GGSALES
PRINT
    UNITS
    ALPHA_UNITS
    DOLLARS
    ALPHA_DOLLARS
    BUDUNITS
    ALPHA_BUDUNITS
    BUDDOLLARS
    ALPHA_BUDDOLLARS
  BY CATEGORY
  BY REGION
WHERE RECORDLIMIT EQ 100;
END
-EXIT


All the columns are formatted I8 in GGSALES...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Virtuoso
posted Hide Post
You could also do it with FTOA, only then you will have to specify a floating format - so it has to be a F or D format. If the input field is itself not a F or D field, it will be converted to F or D before processing.
Consider this code:
DEFINE FILE PRIMARY
BAT_ID1/A6=FTOA(BAT_ID, '(F6)', 'A6');
END
TABLE FILE PRIMARY
PRINT BAT_ID 
BAT_ID1
END
This will also provide the correct result.


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
I believe this will also work.

 
DEFINE FILE PRIMARY
BAT_ID1/I6=BAT_ID;
BAT_IDA/A6=EDIT(BAT_ID1);
END
TABLE FILE PRIMARY
PRINT BAT_ID
BAT_IDA
END


WebFOCUS 8
 
Posts: 74 | Location: Gahanna, OH | Registered: September 22, 2009Report This Post
Member
posted Hide Post
All 3 of these solutions work. Thanks for the help.


Carl

FOCUS 7.1.6 on Windows XP
Output: Excel, HTML, PDF
 
Posts: 27 | Registered: October 19, 2007Report 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] Converting and shortening an integer to alphanumeric

Copyright © 1996-2020 Information Builders