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] Reading Text file from disk

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[CLOSED] Reading Text file from disk
 Login/Join
 
Member
posted
I'm trying to read a Text file (CSV format) which is kept in my domain. I used below code to read the text file but it throwing below error.
Note - I havent created any MDF for employee.txt
file.

APP PATH EMPLYCONNECT
FILEDEF EMPL DISK EMPLOY/employee.txt
TABLE FILE EMPL
PRINT *
END

Error message with i run the procdure
(FOC205) THE DESCRIPTION CANNOT BE FOUND FOR FILE NAMED: EMPL
BYPASSING TO END OF COMMAND

Question - Can i read text/excel file without creating master file?

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


WF 7702m / Windows
 
Posts: 12 | Registered: April 02, 2012Report This Post
Member
posted Hide Post
a small correction in the code
APP PATH EMPLYCONNECT
FILEDEF EMPL DISK EMPLYCONNECT/employee.txt
TABLE FILE EMPL
PRINT *
END


WF 7702m / Windows
 
Posts: 12 | Registered: April 02, 2012Report This Post
Virtuoso
posted Hide Post
Well, if you have created a mastger file for the data you won't be able to read it with TABLE.
And that's what the error message tells you: it can't find the mdf called EMPL.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Virtuoso
posted Hide Post
For a CSV file you can create a plain-jane master file -- one big text field per line. That should read, but then it will be up to you to parse the contents of that single field into its independent parts.

Note that in Dev Studio you can auto-generate a master file from a flat file by right-clicking in the Master Files section of an application directory and selecting New-->Upload Data File. That will parse the file for you for a first round.

If you need to absorb a differently-shaped file each time you'll have to go with the plain-jane option above. If your files will contain the same structure each time and you want to create a master file from your first one option 2 above will help you get started.

J.



 
Posts: 1012 | Location: At the Mast | Registered: May 17, 2007Report This Post
Expert
posted Hide Post
Internally WebFOCUS needs a master file when you issue a TABLE FILE command.

When you issue TABLE FILE EMPL, WebFOCUS looks for the EMPL master file so it can find ouy what type of file it is. This is done by checking the suffix in the master. Then the appropriate module is loaded to read the data.

All the fields are needed as well, so WebFOCUS knows the field names and formats.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Member
posted Hide Post
Thanks for all the answers...that helped!!
If i create Master file for text/Excel, then i need to use FILEDEF command to read Text/excel file.
I wanted to know if is it possible to read text or other flat file without creating master file using FILEDEF command?


WF 7702m / Windows
 
Posts: 12 | Registered: April 02, 2012Report This Post
Expert
posted Hide Post
What do you want to do with the data ?

You can use -READ to read the file, on line at a time, but that is into dialog manager variables.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Master
posted Hide Post
quote:
Originally posted by John_Edwards:
For a CSV file you can create a plain-jane master file -- one big text field per line. That should read, but then it will be up to you to parse the contents of that single field into its independent parts.

Note that in Dev Studio you can auto-generate a master file from a flat file by right-clicking in the Master Files section of an application directory and selecting New-->Upload Data File. That will parse the file for you for a first round.

If you need to absorb a differently-shaped file each time you'll have to go with the plain-jane option above. If your files will contain the same structure each time and you want to create a master file from your first one option 2 above will help you get started.

J.



Have to disagree with this. I have a .csv file and a master that breaks it up into "fields" for reporting.

vhs_beds.mas
FILENAME=VHS_BEDS, SUFFIX=COM     , $
  SEGMENT=VHS_BEDS, SEGTYPE=S0, $
    FIELDNAME=SERV_AREA_ID,      ALIAS=E1, USAGE=A5,    ACTUAL=A5, $
    FIELDNAME=BED_LABEL,         ALIAS=E2, USAGE=A256,  ACTUAL=A256, $
    FIELDNAME=DEPT_ABBREVIATION, ALIAS=E3, USAGE=A20,   ACTUAL=A20, $
    FIELDNAME=BED_NOTES,         ALIAS=E4, USAGE=A1000, ACTUAL=A1000, $
    FIELDNAME=BED_AVAILABILITY,  ALIAS=E5, USAGE=A1,   ACTUAL=A1, $


test.fex:
SET ASNAMES = ON
SET PCOMMA = ON

-SET &FILEPATH = '\\Server\';



-******************************************************************************
-SET &BED_FILE = 'HOSP1\BEDS.csv';
-SET &FULLFILENAME = &FILEPATH | &BED_FILE;

FILEDEF VHS_BEDS DISK "&FULLFILENAME"

TABLE FILE VHS_BEDS
PRINT
	HOSPNAME
	SERV_AREA_ID
	BED_LABEL
	DEPT_ABBREVIATION
	BED_NOTES
	BED_AVAILABILITY

	BY DEPT_ABBREVIATION NOPRINT
	BY BED_LABEL NOPRINT

END


-ABT


------------------------------------
WF Environment:
------------------------------------
Server/Client, ReportCaster, Dev Studio: 7.6.11
Resource Analyzer, Resource Governor, Library, Maintain, InfoAssist
OS: Windows Server 2003
Application/Web Server: Tomcat 5.5.25
Java: JDK 1.6.0_03
Authentication: LDAP, MRREALM Driver
Output: PDF, EXL2K, HTM

------------------------------------
Databases:
------------------------------------
Oracle 10g
DB2 (AS/400)
MSSQL Server 2005
Access/FoxPro
 
Posts: 561 | Registered: February 03, 2010Report This Post
Expert
posted Hide Post
quote:
Have to disagree with this. I have a .csv file and a master that breaks it up into "fields" for reporting


What John is talking about is a generic master to read flat files, then the individual program can break up the line into fields.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6347 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Virtuoso
posted Hide Post
So, you want a general purpose master for a sequential file.
You can create the MASTER in memory and then execute a FOCEXEC using the MASTER:

  
-* Master
EX -LINES 4 EDAPUT MASTER,GNRL,C,MEM
FILENAME=gnrl, SUFFIX=FIX     , $
  SEGMENT=GNRL, SEGTYPE=S0, $
    FIELDNAME=GNRL, ALIAS=GNRL, USAGE=A250, ACTUAL=A250, $
-RUN
-* Focexec
FILEDEF GNRL DISK app/file.txt
TABLE FILE GNRL
PRINT 
     GNRL
END

If A250 is not enough, make it bigger.


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
  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] Reading Text file from disk

Copyright © 1996-2020 Information Builders