Originally posted by JohnB:
Hi Shellie,
This little utility I started working on after hours last week for our dept, so good timing for your request.
I created an MFD to enable WebFOCUS to read the .htm file as a datafile, and a focexec to generate a report with the names of all the focexecs embedded in or referenced by that .htm file.
The MFD is:
FILENAME=READFILE, SUFFIX=FIX, $
SEGMENT=ROOT, SEGTYPE=S0, $
FIELDNAME=LINE, ALIAS=E01, USAGE=A500, ACTUAL=A500, $
The focexec requires you to type in the name of the .htm file including the .htm extension, and the name of the application it resides in. This could be modified to prompt for that, or, ideally, some Dialogue Manager code could be added to loop through all the .htm files in a given application.
-* File list_focexecs.fex
-SET &ECHO=ALL;
-SET &FILE_NAME = 'johns_development/non-custodied_assets_dashboard_6-18-08.htm';
APP FILEDEF READFILE DISK &FILE_NAME
-RUN
DEFINE FILE READFILE
NEW_LINE_1/A500 = TRIM ('L', LINE, 500, '<', 1, 'A500');
EMBEDDED_FEX/A500 = IF EDIT (NEW_LINE_1, '9999999999999999') EQ '![CDATA[-* File '
THEN TRIM ('L', NEW_LINE_1, 500, '![CDATA[-* File ', 16, 'A500')
ELSE 'X';
TEST/A3 = IF NEW_LINE_1 CONTAINS 'ibif_ex="' THEN 'YES' ELSE 'NO';
START_POSITION/I3 = IF TEST EQ 'YES'
THEN POSIT (NEW_LINE_1, 500, 'ibif_ex="', 9, 'I3') + 9
ELSE 0;
NEW_LINE_2/A500 = IF TEST EQ 'YES'
THEN SUBSTR (500, NEW_LINE_1, START_POSITION, 500, 500 - START_POSITION, NEW_LINE_2)
ELSE 'X';
END_POSITION/I3 = IF TEST EQ 'YES'
THEN POSIT (NEW_LINE_1, 500, '.fex"', 5, 'I3') + 4
ELSE 0;
REFERENCED_FEX/A500 = IF START_POSITION NE 0 AND END_POSITION NE 0
THEN SUBSTR (500, NEW_LINE_1, START_POSITION, END_POSITION, END_POSITION - START_POSITION, REFERENCED_FEX)
ELSE 'X';
FOCEXEC_NAME/A500 = IF EMBEDDED_FEX NE 'X' THEN EMBEDDED_FEX ELSE
IF END_POSITION GT START_POSITION THEN REFERENCED_FEX ELSE 'X';
FOCEXEC_TYPE/A12 = IF EMBEDDED_FEX NE 'X' THEN 'Embedded' ELSE
IF END_POSITION GT START_POSITION THEN 'Referenced' ELSE 'ERROR';
END
TABLE FILE READFILE
PRINT
COMPUTE COUNTER/I2 = COUNTER + 1; AS 'Count'
FOCEXEC_TYPE AS 'Type'
BY FOCEXEC_NAME AS 'Focexec'
HEADING
"Focexec Listing Of"
"&FILE_NAME"
" "
WHERE FOCEXEC_NAME NE 'X';
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='TIMES NEW ROMAN',
SIZE=10,
$
TYPE=DATA,
COLUMN=N1,
FONT='ARIAL',
$
TYPE=DATA,
COLUMN=N2,
FONT='ARIAL',
SIZE=10,
$
TYPE=DATA,
COLUMN=N3,
FONT='ARIAL',
$
TYPE=TITLE,
COLUMN=N1,
FONT='ARIAL',
COLOR='NAVY',
JUSTIFY=CENTER,
$
TYPE=TITLE,
COLUMN=N2,
FONT='ARIAL',
SIZE=10,
COLOR='NAVY',
JUSTIFY=CENTER,
$
TYPE=TITLE,
COLUMN=N3,
FONT='ARIAL',
COLOR='NAVY',
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=1,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=1,
OBJECT=TEXT,
ITEM=1,
FONT='ARIAL',
SIZE=12,
COLOR='NAVY',
STYLE=BOLD,
$
TYPE=HEADING,
LINE=2,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=2,
OBJECT=TEXT,
ITEM=1,
FONT='ARIAL',
SIZE=12,
COLOR='NAVY',
STYLE=BOLD,
$
TYPE=HEADING,
LINE=2,
OBJECT=TEXT,
ITEM=2,
FONT='ARIAL',
SIZE=12,
COLOR='NAVY',
STYLE=BOLD,
$
TYPE=HEADING,
LINE=3,
JUSTIFY=CENTER,
$
TYPE=HEADING,
LINE=3,
OBJECT=TEXT,
ITEM=1,
FONT='ARIAL',
SIZE=12,
COLOR='NAVY',
STYLE=BOLD,
$
TYPE=REPORT,
COLUMN=N1,
SEQUENCE=2,
$
TYPE=REPORT,
COLUMN=N2,
SEQUENCE=1,
$
TYPE=REPORT,
COLUMN=N3,
SEQUENCE=3,
$
ENDSTYLE
END
This gives a simple report which counts the number of focexecs, provides their names, and whether they are embedded or referenced. Works very nice in our environment.
Regards,
John