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.

New TIBCO Community Coming Soon
In early summer, TIBCO plans to launch a new community—with a new user experience, enhanced search, and expanded capabilities for member engagement with answers and discussions! In advance of that, the current myibi community will be retired on April 30. We will continue to provide updates here on both the retirement of myibi and the new community launch.

What You Need to Know about Our New Community
We value the wealth of knowledge and engagement shared by community members and hope the new community will continue cultivating networking, knowledge sharing, and discussion.

During the transition period, from April 20th until the new community is launched this summer, myibi users should access the TIBCO WebFOCUS page to engage.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     EDIT Question - extracting characters

Read-Only Read-Only Topic
Go
Search
Notify
Tools
EDIT Question - extracting characters
 Login/Join
 
<M_RIOS75>
posted
I would use the following code to extract the last 2 characters for the field I need which in this case FIELD1=A10

FIELD2/A2 = EDIT(FIELD1,'$$$$$$$$99');

But the field value I'm working with can be anywhere from A10 to A28 (field is A28), how can I make this dynamic; pulling off the last 2 characters on that field?
 
Report This Post
Platinum Member
posted Hide Post
Hi Marvin,

Here's an example using the CAR file and the CAR field(A16).

-*
DEFINE FILE CAR
RJUST_CAR/A16 = RJUST(16, CAR, RJUST_CAR);
LAST2_CAR/A2 = EDIT(RJUST_CAR,'$$$$$$$$$$$$$$99');
END
-*
TABLE FILE CAR
PRINT
CAR
RJUST_CAR
LAST2_CAR
BY COUNTRY
END
-*

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Gold member
posted Hide Post
Using Functions Pg. 5-54 :

DEFINE FILE ...
-*** First trim the trailing blanks...
FLD1_TRIM/A28V = TRIMV('T', ORIGINAL_FLD, 28, ' ', 1, FLD1);
-*** Then find the true length of the data...
FLD1_LGTH/I2 = LENV(FLD1_TRIM, FLD1_LGTH);
-*** Calculate the Starting Position...
FLD1_START/I2 = FLD1_LGTH - 2 ;
-*** Substring to get the result...
FLD1_LAST2/A2 = SUBSTV(28, ORIGINAL_FLD, FLD1_START, FLD1_LGTH, FLD1_LAST2);
END


WF 7.6.6, FOCUS 7.6.4, IBM MVS/TSO, Windows 2003 Server, DB2, MSSQL
 
Posts: 65 | Location: Chicago, IL | Registered: July 26, 2007Report This Post
<M_RIOS75>
posted
Thanks for the replies! I found the first response easier to follow although they were both helpful. Thanks again.
 
Report 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     EDIT Question - extracting characters

Copyright © 1996-2020 Information Builders