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.



Read-Only Read-Only Topic
Go
Search
Notify
Tools
READING A FLAT FILE
 Login/Join
 
<sandy_16>
posted
Hi,
I need to read the contents of a flat file and display it using a fex.can you please send me a sample code...

Regards
Sandeep
 
Report This Post
Expert
posted Hide Post
Sandeep,

Analyse the file and create your own master file description for it. Then use the fielnames in your fex.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
<sandy_16>
posted
how can I create a access file for the master file which uses flat file as the source
 
Report This Post
Silver Member
posted Hide Post
You will have to make a FILEDEF before you start using the master file

eg: your master file name is TEST_DATA
and your text file name is test_data.txt you will have to define as follows

FILEDEF TEST_DATA DISK appname/TEST_DATA.txt
-RUN
 
Posts: 38 | Location: India | Registered: May 18, 2005Report This Post
Expert
posted Hide Post
Venu,

You are correct, however your FILEDEF intimates using an appname and not a full path, so the actual FILEDEF should be an APP FILEDEF mfd_name DISK appname/filename.extn

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Platinum Member
posted Hide Post
sandy_16,
To answer your question, there is no need for an access file when you are working with a flat file (suffix=fix).
 
Posts: 118 | Location: DC | Registered: May 13, 2005Report This Post
<sandy_16>
posted
Hi all,
I would appreciate if the answers were in detail as I am relatively new to this..

Thanks in advance...

Regards
Sandeep
 
Report This Post
Expert
posted Hide Post
ok, HOW TO READ A FLAT FILE 101
3 parts.
1) the master file description
2) the data file
3) the filedef statement in the fex

1)Here's a master for a little file that gives the full statename for each state
FILE=STATELST, SUFFIX=FIX
SEGNAME=BASE, SEGTYPE=S1, $
  FIELD=STABBR, ALIAS=E01, USAGE=A3, ACTUAL=A3,  $
  FIELD=FILL,,A1,A1,$
  FIELD=STNAM, ALIAS=STNAM , USAGE=A16, ACTUAL=A16, $ 
DEFINE StateName/A16=LCWORD(16,STNAM,'A16');$
$$$ comment lines in a master file have $$$ to start them off

2)You just examine your data file, .txt or .prn. or .whatever, and figure out how wide each field needs to be. and then just type up a master file description, save it as filename.MAS
In this case, i named it MYSTATES.MAS
The .MAS part is important, and save it on your edapath or apppath, wherever all your other masters are. The SUFFIX=FIX in line 1 of the master tells focus it is a flat text file in fixed layout.
Heres some data
AK  'ALASKA'
AL  'ALABAMA'
AR  'ARKANSAS'
AS  'AUSTRALIA'
AZ  'ARIZONA'
CA  'CALIFORNIA'
CN  'CANADA'
CO  'COLORADO'
CT  'CONNECTICUT'
DC  'DIST COLUMBIA'
DE  'DELAWARE'
FL  'FLORIDA'

Before you attempt to read your data, issue a CHECK on the master file you've just created,
CHECK FILE MYSTATES
This command will tell you if the master file syntax is ok, or if there's something whacky with it.

3. Now in your fex, issue a filedef command to tell focus what map (the master) to use when reading this file and where the file is.
FILEDEF {master name} DISK {data file name and full path}
e.g.
FILEDEF MYSTATES DISK D:\IBI\APPS\STATELST.TXT
the Master name does NOT have to be the same as the file name. the filename can be long..just don't put blanks in it...it just makes it too hard for a beginner.
FILEDEF MYSTATES DISK D:\IBI\APPS\MYREALLYBIGSTATESFILE.TXT

Now you're ready to read.
TABLE FILE MYSTATES
PRINT StateName BY STABBR
END

You can read any kind of file, comma delimited, tab delimited, pipe delimited, with column headers, without column headers, funky little square boxes delimited, .... etc. Just slight adjustments to the master..thats in course 102.
You should be good to go, for now.

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




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders