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     [CLOSED] extracting proper fields from a txt file

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] extracting proper fields from a txt file
 Login/Join
 
Gold member
posted
Hello,
I am trying to extract certain things from reading a text file and so far so good when things are a bit structured.
However, when I tried reading addresses, I am stuck, for some addresses may have 3 lines only while some may be upto 4 or 5.
Example 1:
Ms. abc def ID:xxxxxxxxxxx
*** WARNING *** DUE: 30-JUNE-2009
---NO ADDRESS--

EXAMPLE 2:
Mr. DEF JHG ID:XXXXXXXXXXX
8871 Bryant Ave DUE: 30-JUNE-2009
Apt 6
Bronx, NY 10474-4734


EXAMPLE 3:
Ms. AAA CCC ID:XXXXXXXXXXX
6581 Barretto St DUE: 30-JUNE-2009
Bronx, NY 10474-6305


EXAMPLE 4:
Ms. UK PERSON ID:XXXXXXXXXXX
1662 Abingdon Court DUE: 30-JUNE-2009
London, W8 6BS
United Kingdom


EXAMPLE 5:
Ms. EXAMPLE5 ID:XXXXXXXXXXX
PO Box 15063 AN DUE: 30-JUNE-2009
Accra,
Ghana

EXAMPLE 6:
Ms. EXAMPLE6 ID:XXXXXXXXXXX
#106 Daxue Street DUE: 30-JUNE-2009
ZhengZhou,
China


these are few examples I am dealing with. As you see, some are 3 lines, some are 4 lines some are even 5 lines and I am to extract name (which is easy, since same line as ID, so an ID flag works for me), addrline1 (mostly street name and number, works with a flag for due: on the same line), but now, my problem is to get city state and zip and country.
example 3 is easy for me to deal with since I know first line is name, second line is street number and name, then third line comes city, state zip. Which I got. HOwever, how do I deal with the rest?
Appreciate any help with this. I am getting dizzy here.
SK

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


on VMS: OpenVMS AXP V8.2 Prod and TestEnvironment
Webfocus: WebFocus 7.6.1 Prod and TestEnvironment
 
Posts: 71 | Registered: May 23, 2004Report This Post
<JG>
posted
What's actually needed is to see a sample of the data not really the output.

Does the data come on a single row for a particular name and address?
Or is it structured as in your example, 1 element per row.

If it's one per row look at the following

data file

  
ENGLAND   ID:00001                                                                        
V12XKE AUTO                                                                               
XJ12L AUTO                                                                                
INTERCEPTOR III                                                                           
TR7                                                                                       
JAPAN     ID:00005                                                                        
B210 2 DOOR AUTO                                                                          
COROLLA 4 DOOR DIX AUTO                                                                   
ITALY     ID:00007                                                                        
2000 4 DOOR BERLINA                                                                       
2000 GT VELOCE                                                                            
2000 SPIDER VELOCE                                                                        
DORA 2 DOOR                                                                               
W GERMANY ID:00011                                                                        
100 LS 2 DOOR AUTO                                                                        
2002 2 DOOR                                                                               
2002 2 DOOR AUTO                                                                          
3.0 SI 4 DOOR                                                                             
3.0 SI 4 DOOR AUTO                                                                        
530I 4 DOOR                                                                               
530I 4 DOOR AUTO                                                                          
FRANCE    ID:00018                                                                        
504 4 DOOR                                                                                



master data.mas

SEGMENT=DATA, SEGTYPE=S0, $
FIELDNAME=DATALINE, ALIAS=E01, USAGE=A91, ACTUAL=A91, $

The focexec

 
FILEDEF DATA DISK c:\TEMP\DATA.FTM
-RUN
TABLE FILE DATA
PRINT
COMPUTE ID/A5= IF DATALINE CONTAINS 'ID:' THEN GETTOK(DATALINE, 91, -1, ':', 5, ID) ELSE LAST ID;
COMPUTE ROWID/I5= IF ID NE LAST ID THEN 1 ELSE LAST ROWID + 1;
COMPUTE ADDRESSLINE/A91=IF DATALINE CONTAINS 'ID:' THEN
                          LJUST(91, (SUBSTR(91, (RJUST(91, (GETTOK(DATALINE, 91, 1, ':', 91, 'A91')), 'A91')), 1, 89, 89, 'A91')), 'A91')
                         ELSE DATALINE;
END
-RUN
 
 
Report This Post
Virtuoso
posted Hide Post
SK,
Could you post your text file? Does it have a MASTER? If so, post it too.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Expert
posted Hide Post
I'd like you to consider, while we're waiting on the above mentioned information, that all variations of your data will need to be accounted for. Thus, the fewer variations of the incoming data, the better it is for you. Obvious, right? Anyway, you might consider, based on various factors, the combination of a "-READ" and associated DM to parse those variations.

We can all provide better and more direct answers / help when we see a sample of your incoming data.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report 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     [CLOSED] extracting proper fields from a txt file

Copyright © 1996-2020 Information Builders