Focal Point
[SOLVED] DELETE lines in master file

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3937061776

July 09, 2015, 02:05 PM
siddu1790
[SOLVED] DELETE lines in master file
Hi,
is it possible to delete lines from master file.
i have successfully got to a point where my text matches and next i want to delete few lines after my matched text and write with a new data.

Can anyone help me how can i do that

so far i am able to write into the file, but i am able to write at the end of the file not after the text is matched

-SET &MAS_COUNT = &LINES;
-REPEAT :MAS_READ FOR &I FROM 1 TO &MAS_COUNT;
-READ mymaster &Text.&I.A22
-IF &Text.&I EQ 'sometext' THEN GOTO Printit ELSE GOTO REPEAT;
-Printit
-WRITE mymaster "sid"
-EXIT
-:MAS_READ

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


WEBFOCUS 8.0
July 09, 2015, 02:30 PM
Tomsweb
Please rephrase the question.


If you want to write to and read from an external file, you need a filedef for this file.

Focal point has numerous examples of this.


Tomsweb
WebFOCUS 8.1.05M, 8.2.x
APP Studio, Developer Studio, InfoAssist, Dashboards, charts & reports
Apache Tomcat/8.0.36
July 09, 2015, 02:37 PM
siddu1790
quote:
to write to and read from an external file, you need a filedef for this fi


I have used file def

FILEDEF mymaster DISK c:/master.mas (APPEND
-RUN
-SET &MAS_COUNT = &LINES;
-REPEAT :MAS_READ FOR &I FROM 1 TO &MAS_COUNT;
-READ mymaster &Text.&I.A22
-IF &Text.&I EQ 'sometext' THEN GOTO Printit ELSE GOTO REPEAT;
-Printit
-WRITE mymaster "sid"
-EXIT
-:MAS_READ

i am able to write at the end of the file, but i want to write at a particular line


WEBFOCUS 8.0
July 09, 2015, 02:38 PM
Francis Mariani
What are you trying to do with this Master?


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
July 09, 2015, 02:42 PM
siddu1790
when ever i update my database table, like adding new field to it, it does not reflect into my master so i am writing a procedure to insert the field names and alias so that it will reflect the changes.


WEBFOCUS 8.0
July 09, 2015, 03:08 PM
Francis Mariani
That is not a good way of updating your Master.

You should use the Reporting Server Console to refresh the master and access files (also called 'metadata' and 'synonym').

You can also use Developer Studio to do this - navigate to the Data Servers area of the Explorer Tree, open the Reporting Server icon, open the list of Applications, open the folder that contains the Master, right-click on the Master and select "Refresh Synonym". This is probably also possible from App Studio.


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
July 09, 2015, 03:59 PM
eric.woerle
Siddu,

It sounds like you are doing a lot of work for something where you could just edit the masterfile in the text editor, or use the refresh synonym option that Francis describes. Either way, the only reason I could ever see doing something like what you have been talking about would be for mass updates. In that case I would rather do it in Unix using find/replace commands or use a text replace program. No need to invent a big process for things that already exist.


Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix
Oracle 11.2.0.2
July 09, 2015, 04:37 PM
Francis Mariani
You can refresh WebFOCUS metadata for dbms tables with a command like this:

REFRESH SYNONYM app_folder/table_name



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
July 09, 2015, 04:41 PM
Francis Mariani
You can refresh metadata in bulk with code like this:

SET HOLDFORMAT = ALPHA
-RUN

TABLE FILE SYSCAT_TABLES
PRINT
TABSCHEMA
TABNAME
WHERE TABSCHEMA IN ('SCHEMA1', 'SCHEMA2');
ON TABLE HOLD AS HOLD01
END
-RUN
-SET &NBR_TABLES = &LINES;

-REPEAT END_REP001 &NBR_TABLES TIMES

-READ HOLD01 NOCLOSE &TABSCHEMA.A128. &TABNAME.A128.

-SET &TAB_NAME = &TABSCHEMA || '.' || &TABNAME;
-SET &SYN_NAME = &TABSCHEMA || '_' || &TABNAME;

DROP SYNONYM app_folder/&SYN_NAME
END
-RUN

-*CREATE SYNONYM [app name]/[new synonym] FOR [target table] DBMS [dbms type i.e. SQLMSS,DB2] AT [adapter name]

CREATE SYNONYM app_folder/&SYN_NAME FOR &TAB_NAME DBMS DB2
END
-RUN

-END_REP001



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
July 09, 2015, 06:09 PM
Waz
What I have found with REFRESH is that it does not refresh the formats of the 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!

July 09, 2015, 10:31 PM
siddu1790
Thanks Francis it worked


WEBFOCUS 8.0