Hello all,
I'm scratching my head over this one. I have some FOCUS code that's generating parts of a Javascript data-structure and the first line of results from the TABLE FILE goes missing. I'm using ON TABLE PCHOLD FORMAT ALPHA to get the TABLE FILE output directly in my code.
However, if I write it to an ALPHA file first and then -INCLUDE that, the first line is there!
Can anyone explain what is going on here?!?
My code is thus:
-HTMLFORM BEGIN
<html>
<body>
<pre>
var masters = {
-HTMLFORM END
-* Collect hold file info
APP QUERY ibisamp HOLD
DEFINE FILE FOCAPPQ
UPDATED/A22 = EDIT(DATE, '99-$99-$9999') | ' / ' | EDIT(TIME, '99:$99');
LEN/I2 = ARGLEN(70, FILENAME, LEN);
UPFILNAM/A70 = UPCASE(70, FILENAME, UPFILNAM);
STEM0/A70 = TRIM('T', UPFILNAM, LEN, '.MAS', 4, 'A70');
STEM1/A70 = TRIM('T', UPFILNAM, LEN, '.FOC', 4, 'A70');
END
MATCH
FILE FOCAPPQ
PRINT
UPDATED AS 'MASTER_DATE'
UPFILNAM AS 'MASTER'
BY STEM0 AS 'STEM'
WHERE UPFILNAM LIKE '%.MAS';
RUN
FILE FOCAPPQ
PRINT
UPDATED AS 'FOC_DATE'
UPFILNAM AS 'FOCFIL'
BY STEM1 AS 'STEM'
WHERE UPFILNAM LIKE '%.FOC';
AFTER MATCH HOLD OLD-OR-NEW
END
-RUN
DEFINE FILE HOLD
LINE/A511 = STEM || ': { file: "' || MASTER || '", created: "' || MASTER_DATE ||
'", focfile: { file: "' || FOCFIL || '", created: "' || FOC_DATE ||
'" }},';
END
TABLE FILE HOLD
PRINT
LINE
BY HIGHEST MASTER_DATE NOPRINT
BY STEM NOPRINT
-*ON TABLE HOLD AS TMP_MASTERS FORMAT ALPHA
ON TABLE PCHOLD FORMAT ALPHA
END
-RUN
-HTMLFORM BEGIN
-*-INCLUDE TMP_MASTERS
};