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] Reading a Master file

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[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, 2015Report 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: 71 | Registered: May 29, 2015Report 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: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report 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, 2015Report 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, 2010Report 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, 2009Report 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, 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     [SOLVED] Reading a Master file

Copyright © 1996-2020 Information Builders