perm filename FQCLST.SIM[SIM,SYS] blob sn#460069 filedate 1979-07-20 generic text, type T, neo UTF8
        COMMENT
        THIS IS THE SECOND PROGRAM (FQCLST) IN A SIMULA SOURCE PROGRAM
        MEASUREMENT SYSTEM. FOR PROGRAM DOCUMENTATION AND
        OPERATING INSTRUCTIONS ON IBM 360/370 SEE
        FOA P RAPPORT C 8350-M3(E5): PROGRAMVARA FOR PROGRAMOPTIMERING.
        FOR OPERATING INSTRUCTIONS ON DEC 10 SEE
        DEC SYSTEM 10 LANGUAGE HANDBOOK PART II, APPENDIX J
	PLEASE PRESERVE IBM/360 AND DEC 10 COMPATIBILITY OF THIS PROGRAM!!!!!

	AUTHOR:		STEFAN ARNBORG DEC 11 1974

	INPUTS:		EDITED PROGRAM LIST ON D
			MEASURED FREQUENCIES ON SYSTAT

	OUTPUT:		FINAL EDIT OF PROGRAM WITH FREQUENCIES ON SYSOUT
        ;
BEGIN INSPECT NEW INFILE("D") DO
BEGIN REF(INFILE)S;
        TEXT I,FLD;
        INTEGER IMLEN,F,P1,P2,L,SZ;
        CHARACTER CH,CBAR;
        BOOLEAN IBM,DEC;
        INTEGER MAX,TMAX,FSUM;
        IF RANK(''')=16R7D THEN IBM:=TRUE ELSE DEC:=TRUE;
        IF IBM THEN
        BEGIN CBAR:='!';
                IMLEN:=80;
        END;
        IF DEC THEN
        BEGIN CBAR:='|';
                IMLEN:=135;
        END;
        OPEN(BLANKS(IMLEN));
        I:-IMAGE;
        S:-NEW INFILE("SYSTAT");
        S.OPEN(BLANKS(80));
        CH:=INCHAR;
        WHILE NOT ENDFILE DO
        BEGIN
                IF CH NE CBAR THEN
                BEGIN   IF SYSOUT.POS>1 THEN OUTIMAGE;
                        IF MAX NE 0 THEN OUTINT(MAX,6); SYSOUT.SETPOS(9);
                        IF MAX>TMAX THEN TMAX:=MAX;
                        OUTTEXT(I.STRIP); OUTIMAGE; INIMAGE; LASTITEM; 
                        CH:=INCHAR;
                        MAX:=0;
                END ELSE
                BEGIN   P1:=THIS INFILE.POS; F:=S.ININT; CH:=INCHAR;
                        FSUM:=FSUM+F;
                        IF F>MAX THEN MAX:=F;
                        WHILE CH NE CBAR AND THIS INFILE.POS<IMLEN-2 DO CH:=INCHAR;
                        P2:=THIS INFILE.POS-1;
                        L:=P2-P1;
                        IF L>8 THEN L:=8;
                        SZ:=IF F=0 THEN 0 ELSE
                        IF F<10 THEN 1 ELSE
                        IF F<100 THEN 2 ELSE
                        IF F<1000 THEN 3 ELSE
                        IF F<10000 THEN 4 ELSE
                        IF F<100000 THEN 5 ELSE
                        IF F<1000000 THEN 6 ELSE
                        IF F<10000000 THEN 7 ELSE 8
                        ;
                        FLD:-I.SUB(P1,L);
                        IF SZ=0 THEN 
                        BEGIN WHILE FLD.MORE DO FLD.PUTCHAR('-'); END ELSE
                        IF SZ>L THEN
                        BEGIN OUTINT(F,9); WHILE FLD.MORE DO FLD.PUTCHAR('*');
                        END ELSE FLD.SUB(1,SZ).PUTINT(F);
                END
        END;
        OUTIMAGE;
        OUTTEXT("***MAX FREQUENCY:"); OUTINT(TMAX,8); OUTTEXT(" ***");
        OUTTEXT("***SUM FREQUENCY:"); OUTINT(FSUM,8);OUTTEXT(" ***");
        WHILE NOT S.LASTITEM DO
        BEGIN OUTIMAGE; OUTINT(S.ININT,9); END;
        S.CLOSE;
        CLOSE;
END;
END;