Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Reading a Master file
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Reading a Master file
 Login/Join
 
Member
posted
Can some one help me how we can read a master file and compare a value in the master file and append text

i am reading master file
FILEDEF master DISK c:/mymaster.mas (APPEND
-RUN
SET &Text ="some"
-REPEAT TOEND WHILE master conatins &Text
-WRITE master "abcd"
-TOEND

This message has been edited. Last edited by: <Kathryn Henning>,


WEBFOCUS 8.0
 
Posts: 21 | Registered: July 08, 2015Reply With QuoteReport This Post
Gold member
posted Hide Post
One way to do this type of comparison is to issue the command:

CHECK FILE master_name HOLD

This generates a HOLD file with all the components of the MASTER, which may then be examined with a simple TABLE request.


WebFOCUS 8
Windows, All Outputs
 
Posts: 65 | Registered: May 29, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Siddu,
We need a bit more detail of what you are trying to achieve.
For example, in your -REPEAT you are not reading your "master" so how can you issue a CONTAINS test.


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

 
Posts: 1954 | Location: Tel Aviv, Israel | Registered: March 23, 2006Reply With QuoteReport This Post
Member
posted Hide Post
Thanks for your replies sh98110 and danny,
i started to learn focus programming 2 days ago.. what i am trying to accomplish is , i want to read a master file and search for a particular line in the master file and i want to edit (delete or add) some text or add new lines to the master file and save it. I don't know exactly how can i do that. after a lot of struggling i was able to read the master file , but having a hard time comapring the text and modifying it
Below is my sample code :-

-SET &ECHO=ALL;

FILEDEF mymaster DISK mymaster.mas (LRECL 150)
FILEDEF mymaster DISK mymaster.mas (APPEND
-RUN
CHECK FILE mymaster1 HOLD AS testholdfile

TABLE FILE mymaster1
PRINT *
ON TABLE HOLD AS COMPDEP FORMAT ALPHA
END
-RUN
-SET &MAS_COUNT = &LINES;
-REPEAT :MAS_READ FOR &I FROM 1 TO &MAS_COUNT;
-READ mymaster &Text.&I.A150
-TYPE text =&Text.&I.A150
-:MAS_READ

From the above code i can read the master file and i can display it using text variable , next i used IF &Text.&I.A150 EQ " some text" to compare it but i am having UNRECOGNIZED COMMAND IF error

how can i modify the when it matches the text , i know java programming we can use if(text ="someText"){
----logic to modify
}

how can we do it in focus programming

Any help would be appreciated

Thank you


WEBFOCUS 8.0
 
Posts: 21 | Registered: July 08, 2015Reply With QuoteReport This Post
Master
posted Hide Post
My question is: Why would you want to add or delete lines from a master file? Since it describes your data surely you are going to have a problem if you mess with it.

On the other hand, if you are creating a new master starting with an old one, why not just copy it and then edit the copy?

This is another of those situations where knowing what the fianl objective is would help a lot in providing the most appropriate solution.


WebFOCUS 7.7.05 Windows, Linux, DB2, IBM Lotus Notes, Firebird, Lotus Symphony/OpenOffice. Outputs PDF, Excel 2007 (for OpenOffice integration), WP
 
Posts: 674 | Location: Guelph, Ontario, Canada ... In Focus since 1985 | Registered: September 28, 2010Reply With QuoteReport This Post
Guru
posted Hide Post
quote:
Why would you want to add or delete lines from a master file? Since it describes your data surely you are going to have a problem if you mess with it.


True.

Are you trying some sample code or something for file reading, writing etc. ?


Thanks,

Ramkumar.
WebFOCUS/Tableau
Webfocus 8 / 7.7.02
Unix, Windows
HTML/PDF/EXCEL/AHTML/XML/HTML5
 
Posts: 394 | Location: Chennai | Registered: December 02, 2009Reply With QuoteReport This Post
Expert
posted Hide Post
This is the last thing someone with two days of FOCUS programming knowledge needs to do.


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, 2005Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Reading a Master file

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.