Focal Point
[SOLVED] &LINES count after an append

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

September 06, 2017, 04:04 PM
rogerwilkouk
[SOLVED] &LINES count after an append
When using the &LINES function after an append it seems to give the number of lines that it added last and not a complete count of the file.

 FILEDEF CAR2 DISK CAR2
TABLE FILE CAR
PRINT
     COUNTRY
     CAR
     MODEL
     BODYTYPE
WHERE COUNTRY EQ 'FRANCE';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR2 FORMAT ALPHA
ON TABLE SET XLSXPAGESETS ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

TABLE FILE CAR
PRINT
     CAR.ORIGIN.COUNTRY
     CAR.COMP.CAR
     CAR.CARREC.MODEL
     CAR.BODY.BODYTYPE
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR1 FORMAT ALPHA
ON TABLE SET XLSXPAGESETS ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
FILEDEF CAR2 DISK CAR2 (APPEND

TABLE FILE CAR1
PRINT
     COUNTRY
     CAR
     MODEL
     BODYTYPE
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR2 FORMAT ALPHA
ON TABLE SET XLSXPAGESETS ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

-TYPE &LINES 


The above code returns a count of 4 (which is the count from England but is excluding the 1 from France which was already in the file.
If we re-read the file into a secondary hold file it gives us the correct count.


 FILEDEF CAR2 DISK CAR2
TABLE FILE CAR
PRINT
     COUNTRY
     CAR
     MODEL
     BODYTYPE
WHERE COUNTRY EQ 'FRANCE';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR2 FORMAT ALPHA
ON TABLE SET XLSXPAGESETS ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

TABLE FILE CAR
PRINT
     CAR.ORIGIN.COUNTRY
     CAR.COMP.CAR
     CAR.CARREC.MODEL
     CAR.BODY.BODYTYPE
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR1 FORMAT ALPHA
ON TABLE SET XLSXPAGESETS ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END
FILEDEF CAR2 DISK CAR2 (APPEND

TABLE FILE CAR1
PRINT
     COUNTRY
     CAR
     MODEL
     BODYTYPE
WHERE COUNTRY EQ 'ENGLAND';
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR2 FORMAT ALPHA
ON TABLE SET XLSXPAGESETS ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

TABLE FILE CAR2
PRINT
     COUNTRY
     CAR
     MODEL
     BODYTYPE
ON TABLE SET PAGE-NUM NOLEAD
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE HOLD AS CAR3 FORMAT ALPHA
ON TABLE SET XLSXPAGESETS ON
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     INCLUDE = IBFS:/EDA/EDASERVE/_EDAHOME/ETC/endeflt.sty,
$
ENDSTYLE
END

-TYPE &LINES 


Is this correct or am I mis-understanding how the &LINES is supposed to function?

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


WF 81.5, Windows7
AS/400 Database.
All Outputs

September 06, 2017, 04:39 PM
j.gross
&LINES will be the number of lines of output accumulated in the last command, if it is a command (such as TABLE or GRAPH) that does such. &LINES is (I believe) computed before the command disposes of the lines (via HOLD, SAVE, or as a formatted report), so the "(APPEND" in your FILEDEF does not influence the value of &LINES for that step.

In your case that last command is
TABLE FILE CAR2
PRINT
     COUNTRY
     CAR
     MODEL
     BODYTYPE
...
ON TABLE HOLD AS CAR3 FORMAT ALPHA
...
END

which reads the entire file (original rows plus appended rows) that is target of the HOLD in the previous step.
September 06, 2017, 04:47 PM
rogerwilkouk
Thanks for the quick reply.
That was what I sort-of figured based on how it was working but just wanted clarification


WF 81.5, Windows7
AS/400 Database.
All Outputs