**************************** LREPORTS.CMD
********** Asks user if they want keyword
********** listing or to search references
********** By subjects.  Provides the keyword
********** listing, branches to LIBFIND for
********** search by subject.

ERASE
STORE " " TO RCHOICE
@ 5,10 SAY " Which Report do you want "
@ 7, 5 SAY "1. Keyword Listing"
@ 8, 5 SAY "2. References by Subject"
@ 10,8 SAY "Enter choice (1-2) " GET RCHOICE 
READ

*********** Do appropriate report based upon user's request.
DO CASE

   CASE RCHOICE = "1"
      ******* Ask about hardcopy
      ERASE
      STORE " " TO LP
      @ 5,10 SAY " Send Keywords to printer (Y/N) " GET LP
      READ

      IF !(LP)="Y"
         *SET PRINT ON
      ENDIF (lp=y)

      *********** print keywords in two alphabetized columns.
      ERASE
      USE KEYWORDS
      GO BOTT
      STORE (#+1)/2 TO MIDDLE
      STORE 1 TO COUNTER
      USE KEYWORDS INDEX KEYWORDS
      STORE "Y" TO OK
      DO WHILE COUNTER <= MIDDLE .AND. !(OK)="Y" 
         ? KEYWORD
         SKIP MIDDLE
         IF .NOT. EOF
            ?? KEYWORD
            SKIP -1*MIDDLE-1
         ENDIF (not eof)
         STORE COUNTER + 1 TO COUNTER
  
         ************** If keyword list going to the screen,
         ************** Pause every 20 lines.
         IF COUNTER/20 = INT(COUNTER/20) .AND. !(LP) <> "Y"
            ?
            ?
            ? " Continue? (Y/N) "
            WAIT TO OK
         ENDIF (counter/20 and not lp)

         ************* If keyword list going to the 
         ************* printer, eject page every 60 lines.
         IF COUNTER/60 = INT(COUNTER/60) .AND. !(LP) = "Y"
            EJECT
         ENDIF (counter/60 and lp)      


    ENDDO (counter and ok)
    
    ************* If keyword list going to the screen, pause
    ************* before returning to the main menu.
    IF !(LP) <> "Y"
       ?
       ?
       ? " Press any key to return to main menu..."
       WAIT
    ENDIF (lp <> y)



    CASE RCHOICE = "2"
         DO LIBFIND

ENDCASE
RETURN
