Focal Point
[SOLVED] dynamic master description

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

August 08, 2017, 10:02 AM
JACQUETL
[SOLVED] dynamic master description
hi,

I would like to update an existing master file with fex.
I want to browse app path directory , open every master file, and write on each line of each master a news TITLE tag.
It's for Oracle master files.

Example :

Original Master :

Master ABCD.MAS
FILENAME=ABCD, SUFFIX=SQLORA , $
SEGMENT=ABCD, SEGTYPE=S0, $
FIELDNAME=CHAMP1, ALIAS=CHAMP1, USAGE=A26V, ACTUAL=A26V, MISSING=ON, $
FIELDNAME=CHAMP2, ALIAS=CHAMP2, USAGE=A15V, ACTUAL=A15V,
MISSING=ON, $

target Master (with the same name, overwrite existing master)
Master ABCD.MAS
FILENAME=ABCD, SUFFIX=SQLORA , $
SEGMENT=ABCD, SEGTYPE=S0, $
FIELDNAME=CHAMP1, ALIAS=CHAMP1, USAGE=A26V, ACTUAL=A26V,TITLE='DESC 1', MISSING=ON, $
FIELDNAME=CHAMP2, ALIAS=CHAMP2, USAGE=A15V, ACTUAL=A15V,TITLE='DESC 2',
MISSING=ON, $

Any idea how to do this ?

This message has been edited. Last edited by: FP Mod Chuck,


Webfocus 8.201M.
Windows
InfoAssist +
Chrome, IE, Excel, HTML; PDF, AHTML,GRAPH
August 08, 2017, 10:14 AM
Wep5622
You can get the app directories and their files using APP QUERY and friends. That also allows filtering on certain extensions. Searching these forums should turn up some examples.

Next, you can go through each file using -REPEAT and -READ to read each line into an amper-variable. There should be enough examples of that as well.

Finally, you alter the contents of that variable if it contains FIELDNAME and not TITLE.

The difficult bits are determining which master files qualify (ie. they need an equaly named access file that references the appropriate CONNECTION) and determining what the contents of the added TITLE field should be.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
August 08, 2017, 10:27 AM
JACQUETL
Thanks for your answer Wep5622

Ok for -READ but how can i update overwrite file ?
with MODIFY command ?


Webfocus 8.201M.
Windows
InfoAssist +
Chrome, IE, Excel, HTML; PDF, AHTML,GRAPH
August 08, 2017, 10:49 AM
FP Mod Chuck
Hi Jacquetl

I wrote a application that does just what you are looking for. The customer was using SQL Server and wanted the TITLE and DESCRIPTION to be the real field name from SQL Server but you can fix that part of the code to be whatever you want. I am going to to e-mail you the application.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
August 08, 2017, 10:50 AM
EricH
For something like this I'd recommend using APP COPYF to copy your MFDs to a temp folder. You could then use -READ and -WRITE in a loop to overwrite your original MFD.
August 08, 2017, 10:53 AM
JACQUETL
Oh great chuck wolff, e-mail me the application .
I w'ill test it

Thanks


Webfocus 8.201M.
Windows
InfoAssist +
Chrome, IE, Excel, HTML; PDF, AHTML,GRAPH
November 16, 2020, 04:03 PM
Joe Beydoun
Can I get a copy of this application please, I'm dealing with the same issue.


version 8202M
Reporting Server on
Windows Server using DB2 Connect to access data from iseries.
November 16, 2020, 07:46 PM
FP Mod Chuck
Joe

This app works fine with version 8.1.05 but I tried it with 8.2.06 and it no longer works. I will try to debug it and let you know.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats
November 17, 2020, 12:55 PM
Danny-SRL
This might do the trick:
  
-SET &ECHO=ALL;
-* File jacquetl.fex
FILEDEF ABCD DISK ABCD.MAS
FILEDEF NEWMAS DISK NEWMAS.MAS (APPEND
SET HOLDLIST=PRINTONLY
-RUN
-WRITE ABCD FILENAME=ABCD, SUFFIX=SQLORA , $
-WRITE ABCD SEGMENT=ABCD, SEGTYPE=S0, $
-WRITE ABCD FIELDNAME=CHAMP1, ALIAS=CHAMP1, USAGE=A26V, ACTUAL=A26V, MISSING=ON, $
-WRITE ABCD FIELDNAME=CHAMP2, ALIAS=CHAMP2, USAGE=A15V, ACTUAL=A15V, MISSING=ON, $
-RUN
!TYPE ABCD.MAS
-RUN
TABLE FILE SYSCOLUM
IF TBNAME EQ ABCD
PRINT
COMPUTE L1/A640='FILENAME=' || TBNAME || ', SUFFIX=' || TBTYPE;
ON TABLE HOLD AS NEWMAS FORMAT ALPHA
END
-RUN
TABLE FILE SYSCOLUM
IF TBNAME EQ ABCD
PRINT
COMPUTE L1/A640='SEGNAME=' || SEGNAME || ', SEGTYPE=S0' ;
ON TABLE SAVE AS NEWMAS
END
-*-GOTO A
-RUN
DEFINE FILE SYSCOLUM
TTL/A40=DECODE NAME('CHAMP1' 'DESC 1' 'CHAMP2' 'DESC 2' ELSE 'OTHER');
MISSING/A3=IF NULLABLE EQ 1 THEN 'ON' ELSE 'OFF';
END
-RUN
TABLE FILE SYSCOLUM
IF TBNAME EQ ABCD
PRINT
COMPUTE L1/A1200='FIELDNAME=' || NAME || ', ALIAS=' || ALIAS || ', USAGE=' || USAGE || ', ACTUAL=' || ACTUAL ||
                ', TITLE=''' || TTL || ''', MISSING=' || MISSING  || ', $';

ON TABLE SAVE AS NEWMAS
END
-RUN
-A
!TYPE NEWMAS.MAS



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

November 17, 2020, 03:28 PM
FP Mod Chuck
I was able to get my app working with 8.2.06 and sent it to Joe but Joe you should consider Daniel's option as well.


Thank you for using Focal Point!

Chuck Wolff - Focal Point Moderator
WebFOCUS 7x and 8x, Windows, Linux All output Formats