perm filename CMS3.SHT[T,LSP] blob sn#622738 filedate 1981-11-05 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	 TALLYHO:
C00006 ENDMK
CāŠ—;
 TALLYHO:
        PROCEDURE OPTIONS (MAIN);
        
        /*PROGRAM TO EVALUATE CIRCULATION PATTERNS*/
        
        DECLARE
	 DAYS_COUNT (9,3) FIXED (3,0),/*ARRAY FOR WHOLE TABLE*/
	 DAYS_TOTAL (9) FIXED (5,0),/*ARRAY FOR DAYS OUT FOR EA. CLASS*/
	 CODE_TOTAL (3) FIXED (5,0),/*ARRAY FOR DAYS OUT FOR EA. CODENUM*/
	 CLASS FIXED (1),/*CLASS OF BOOK*/
	 DEWEY_NUM FIXED (3,0),/*DEWEY NO. ASSIGNED TO BOOK*/
	 DAYS_OUT FIXED (3,0),/*NO. OF DAYS OUT FOR EA. BOOK*/
	 BORROWED FIXED (3,0),/*DAY BOOK WAS BORROWED*/
	 RETURNED FIXED (3,0),/*DAY BOOK WAS RETURNED*/
	 ID FIXED (6,0),/*ID OF BORROWER*/
	 CODE FIXED (1),/*CODE NO. OF BORROWER*/
	 MORE BIT (1),/*END FLAG*/
	 TOTAL_DAYS_OUT FIXED (5,0);/*SUM OF DAYS_TOTAL*/
                
        /*INITIALIZED VARIABLES*/
        
        DAYS_COUNT = 0;
        DAYS_TOTAL = 0;
        CODE_TOTAL = 0;
        DAYS_OUT = 0;
        TOTAL_DAYS_OUT = 0;
        MORE = '1' B;
        ON ENDFILE (SYSIN) MORE = '0' B;
        
        GET LIST (DEWEY_NUM, BORROWED, RETURNED, ID, CODE);
        
 LOOP:  DO WHILE (MORE);
        CLASS = DEWEY_NUM/100;
        DAYS_OUT = RETURNED - BORROWED;
        DAYS_COUNT (CLASS, CODE) = DAYS_COUNT (CLASS, CODE) + DAYS_OUT;
        DAYS_TOTAL (CLASS) = DAYS_TOTAL (CLASS) + DAYS_OUT;
        CODE_TOTAL (CODE) = CODE TOTAL (CODE) + DAYS_OUT;
        TOTAL_DAYS_OUT = TOTAL_DAYS_OUT + DAYS_OUT;
        END LOOP;
        
        /*PRINT RESULTS*/
        
        PUT SKIP EDIT ('DEWEY CLASS','BORROWER STATUS','TOTAL') (A(20),
                A(30),A(5));
        PUT SKIP EDIT ('UNDERGRAD','GRAD','FACULTY') (X(19),A(12),A(7),
                A(7));
        
 SHOWCLASS:
        DO CLASS = 1 TO 9;
                PUT SKIP EDIT (CLASS, (DAYS_COUNT (CLASS,CODE)
                DO CODE = 1 TO 3), DAYS_TOTAL (CLASS)) (F(6),F(13),
                        F(10),F(9),F(15));
                END SHOWCLASS;
        
        PUT SKIP EDIT ('TOTAL', CODE_TOTAL (*), TOTAL_DAYS_OUT) 
            (X(2),A(5),
             F(12),F(10),F(9),F(15));
        
        END TALLYHO;