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] Flat File Problem

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] Flat File Problem
 Login/Join
 
Platinum Member
posted
I followed the steps from susannah Posted May 14, 2006 11:30 PM on HOW TO READ A FLAT FILE 101. Since this was the first use of a flat file, I used the exact example. The CHECK FILE is successful. However, the end results are
0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0
Any ideas on what to check next?

Master file:
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

Flat file:
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'

fex:
FILEDEF MYSTATES DISK C:\IBI\APPS\STATELST.TXT

TABLE FILE MYSTATES
PRINT *
END

Thank you,
Geri

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




Prod: WebFOCUS 7.7.05 OS:Linux; Upgrading to: WebFOCUS 8.1.05 OS:Windows; Outputs: HTML, PDF, Excel; Adapters: SAP, MySQL, Oracle incl Report Caster
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Virtuoso
posted Hide Post
quote:
C:\IBI\APPS\STATELST.TXT

Is this really the place and name of the file containing the state names? Since your profile states you might be on unix ...


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Platinum Member
posted Hide Post
GamP,
This is the actual location of the file at the moment. In the future, I will need it on the server. I began with a simple location for the beginning.
Thank you,
Geri
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Expert
posted Hide Post
Take the quotes out and it should work fine...


Tom Flynn
WebFOCUS 8.1.05 - PROD/QA
DB2 - AS400 - Mainframe
 
Posts: 1972 | Location: Centennial, CO | Registered: January 31, 2006Report This Post
Platinum Member
posted Hide Post
Took the quotes out and made the file name on the c drive the same as the mas file.
Still
0 NUMBER OF RECORDS IN TABLE= 0 LINES= 0

Thank you,
Geri
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Platinum Member
posted Hide Post
Hi Geri,

Here's an example that creates both the data and the master within the same focexec. Try running this and see if it works.

-*
-*** FD_DATA - CREATE FILE OF DATA
-*
FILEDEF FD_DATA DISK your_statelst_data.txt
-RUN
-WRITE FD_DATA AK ALASKA
-WRITE FD_DATA AL ALABAMA
-WRITE FD_DATA AR ARKANSAS
-WRITE FD_DATA AS AUSTRALIA
-WRITE FD_DATA AZ ARIZONA
-WRITE FD_DATA CA CALIFORNIA
-WRITE FD_DATA CN CANADA
-WRITE FD_DATA CO COLORADO
-WRITE FD_DATA CT CONNECTICUT
-WRITE FD_DATA DC DIST COLUMBIA
-WRITE FD_DATA DE DELAWARE
-WRITE FD_DATA FL FLORIDA
-CLOSE
-RUN
-*
-*** FD_MAST - CREATE MASTER
-*
FILEDEF FD_MAST DISK statelst.mas
-RUN
-WRITE FD_MAST FILE=STATELST, SUFFIX=FIX, $
-WRITE FD_MAST SEGNAME=STATELST, SEGTYPE=S0, $
-WRITE FD_MAST FIELDNAME=STABBR, ALIAS=E01, USAGE=A02, ACTUAL=A02, $
-WRITE FD_MAST FIELDNAME=FILL01, ALIAS=E02, USAGE=A01, ACTUAL=A01, $
-WRITE FD_MAST FIELDNAME=STNAME, ALIAS=E03, USAGE=A16, ACTUAL=A16, $
-WRITE FD_MAST DEFINE StateName/A16 = LCWORD(16,STNAME,'A16'); $
-CLOSE
-RUN
-*
-*** FILEDEF - MASTER TO DATA FILE
-*
FILEDEF STATELST DISK your_statelst_data.txt
-RUN
-*
-*** REPORT - STATELST
-*
TABLE FILE STATELST
PRINT
STABBR
STNAME
StateName
END
-RUN

Jim


WebFocus 8.201M, Windows, App Studio
 
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008Report This Post
Platinum Member
posted Hide Post
Jim,
Thank you for the info.
This produces data on the screen. I do not see where the mas file and the txt file were written to although this shows the file can work.
Geri
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Expert
posted Hide Post
Jim's example creates the master and data files in the temporary area which is deleted after the fex ends.

Unless you're running this code on your PC, the "C drive" that you coded in the FILEDEF refers to the drive of the server where WebFOCUS is installed.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Platinum Member
posted Hide Post
Hi Geri,

Francis is correct.

In this example, the txt file named "your_statelst_data.txt" and the mas file named "statelst.mas" are written to a temporary directory that is created and used while your focexec is running. When the focexec is done, this temp directory is gone. Therefore, your STATELST file is only available while this fex is running.

If you need to access an existing flat file, then we need to figure out 1) where to put the flat file(and maybe the mas file) and 2) how to code the FILEDEF command to associate the master to the actual location/name of the flat file.

My webfocus server is a windows box so my experience is with that. Someone from the unix world may need to help in your case.

Jim


WebFocus 8.201M, Windows, App Studio
 
Posts: 227 | Location: Lincoln Nebraska | Registered: August 12, 2008Report This Post
Platinum Member
posted Hide Post
Jim,
That makes sense. Based on this information, it seems my problem is accessing the flat file. Ideally, the flat file will be place on the server.
Thank you,
Geri
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Expert
posted Hide Post
Geri, have you verified that the flat file is indeed on the server?

Also, if you use Developer Studio, there is a GUI "Upload Data File" tool you access by right-clicking the "Master Files" virtual folder of the Application folder where you wish to locate your file. You define the fields in the tool, it uploads the file and generates the master.

In my experience it works quite well and is very handy when you have no other way to access the server (FTP or mapped drive). It gets flaky when there is a huge amount of data.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Virtuoso
posted Hide Post
quote:
Ideally, the flat file will be place on the server.

Which is running unix, correct?
The DevStudio you're now using, does it communicate with the local server on your own PC or does it communicate with the unix server?
If the first, then your setup should have worked. If the second then it is correct that it does not work, because it can't find your local file on the server. If that's the case, follow Francis' advise.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Platinum Member
posted Hide Post
Hello,
Our Dev Studio communicates with the server. I am able to create the master file. I can confirm the txt file is on the server. I can ftp the data file (.txt) to the server. I can create the fex. I created a folder named flat_files to store this data. However, when I run the fex, it does not seem to find the flat file. That seems to be my problem at this time.
Thank you,
Geri
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report This Post
Platinum Member
posted Hide Post
This is solved. I worked with the information from Jim and was able to read the file from the server. The fex is below.

FILEDEF MYSTATES DISK /u/iadmin/ibi/apps/flat_files/your_statelst_data.txt

FILEDEF STATELST DISK /u/iadmin/ibi/apps/flat_files/your_statelst_data.txt
-RUN
-*
TABLE FILE STATELST
PRINT
STABBR
STNAME
StateName
END
-RUN

Thank you everyone for your help on this one.
Geri
 
Posts: 102 | Location: Cincinnati, Oh USA area | Registered: November 02, 2006Report 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] Flat File Problem

Copyright © 1996-2020 Information Builders