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] replace 4th character with a letter

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] replace 4th character with a letter
 Login/Join
 
Silver Member
posted
Hi:

I am trying to figure out how to convert the 4th character of a 10 digit phone number to an alpha character. For example, the phone number 3035551234 would be converted to 303F551234. I have looked through focal point and IBI's tech site -- but I can't get SUBSTR to work - assuming that is the way to go.

Any assistance is greatly appreciated.

simba

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


WF 7.7/Windows
 
Posts: 42 | Location: Denver, CO | Registered: January 04, 2007Report This Post
Expert
posted Hide Post
How about "EDIT"? Concatenate the first three characters with (whatever one character you want) and then concatenate the remaining six characters. Unless the 4th characters is a consistent / know character; then translate it...
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Virtuoso
posted Hide Post
I am assuming that the phone number field is alpha, as you're inserting an alpha character into it. Easiest way is using the EDIT function as Doug suggests, but just make it a mask:

PHONE_NEW/A10=EDIT(PHONE,'999$F9999999');

The $ omits the 4th character and the F inserts that character into the string at the current position.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Expert
posted Hide Post
I'm not sure what to assume. Simba: is "303F551234" the "10 digit phone number" that needs to have the "F" converted to something else? if so, what do you want to convert it to?
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report This Post
Member
posted Hide Post
Simba...It's fairly easy. There are probably many ways but here's one...
Let's say that the phone number field is called PHONE/I10

DEFINE FILE XXX
PHONE_ALPHA/A10 = EDIT(PHONE);
PPHONE_NEW/A10 = EDIT(PHONE_ALPHA,'9999' ||
EDIT(PHONE_ALHA,'$$$$F99999');
 
Posts: 14 | Registered: December 30, 2005Report This Post
Silver Member
posted Hide Post
Thanks to everyone for their suggestions -- I hadn't thought to use EDIT for this. I believe I am close to getting this to work the way I need it to.

Doug -- what I need to do is translate the 4th character in a 10 digit phone number to an alpha character. 0 is translated to A, 1 is translated to B and so on. The rationale behind this is convoluted.

thanks. simba


WF 7.7/Windows
 
Posts: 42 | Location: Denver, CO | Registered: January 04, 2007Report This Post
Expert
posted Hide Post
DEFINE FILE XXX
  PHONE_ALPHA/A10 = EDIT(PHONE);
  5th_DIGIT/A1    = EDIT(PHONE_ALPHA,'$$$$$9');
  REDO_5TH/A1     = DECODE 5th_DIGIT (
                    '0' 'A'
                    '1' 'B'
                    '2' 'C'
                    '3' 'D'
                    '4' 'E'
                    '5' 'F'
                    '6' 'G'
                    '7' 'H'
                    '8' 'I'
                    '9' 'J' ELSE 'X');
  PHONE_NEW/A10   = EDIT(PHONE_ALPHA,'9999' || REDO_5TH | EDIT(PHONE_ALHA,'$$$$$99999');
END


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Silver Member
posted Hide Post
Tom -- many thanks. your solution worked perfectly.

simba


WF 7.7/Windows
 
Posts: 42 | Location: Denver, CO | Registered: January 04, 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] replace 4th character with a letter

Copyright © 1996-2020 Information Builders