         SYSTEM   SIG7FDP
         SYSTEM   BPM
*
*        START    SET A FILE TO KEYED SEQUENTIAL ACCESS AND POSITION
*                 TO A SPECIFIED KEY VALUE
*
*                 THE USER WHO WISHES TO PROCESS A KEYED FILE SEQUEN-
*                 TIALLY IS REQUIRED TO SPECIFY 'ACCESS IS SEQUENTIAL'
*                 THE USER IS EXPECTED TO OPEN THE FILE AS SEQUENTIAL
*                 AND THEN CALL UPON THIS ROUTINE TO RE-DEFINE IT AS
*                 'KEYED SEQUENTIAL'
*                 THE FILE WILL THEN BE POSITIONED TO THE SPECIFIED
*                 KEY VALUE AND A RETURN WILL BE MADE TO THE USER
*                 PROGRAM WHERE READING WILL PROCEED SEQUENTIALLY
*                 IF A RECORD EXISTS WHOSE KEY MATCHES THE SPECIFIED
*                 VALUE, IT WILL BE THE FIRST RECORD ACCESSED BY THE
*                 NEXT SEQUENTIAL READ
*                 IF THE SPECIFIED KEY IS NOT IN THE FILE, THE NEXT
*                 SEQUENTIAL READ WILL ACCESS THE FIRST RECORD WITH A
*                 HIGHER KEY VALUE
*
*      USER SYNTAX:
*        ENTER    START  FILE-NAME, DATA-NAME-1, DATA-NAME-2
*
*                 START: THE ENTRY POINT IN THE RUN-TIME ROUTINE
*             FILE-NAME: THE APPROPRIATE FD NAME (SEQUENTIAL)
*           DATA-NAME-1: CONTAINS THE MONITOR RECORD KEY (DISPLAY)
*           DATA-NAME-2: CONTAINS THE LENGTH OF DATA-NAME-1
*                        (COMPUTATIONAL)
*
*        AUTHER   YOW-YUAN ROBERT LIN            MAY, 1970
*
         REF      C:ABA                                                 START
         DEF      START
         OPEN     KEYAREA,RETURN,SAVE16
         OPEN     FPTC,FPTO,FPTR,FPTP
START    LCI      9                 SAVE R14 THRU R6                    START
         STM,14   SAVE16
         STW,15   RETURN
         AWM,14   RETURN            UPDATE RETURN ADDR
         CI,14    3                                                     START
         BE       %+4                                                   START
         LI,2     X'9A'                                                 START
         STB,2    10                                                    START
         B        C:ABA                                                 START
         LI,4     0
         LI,5     X'1FFFF'
         LS,4     *15               R4 = DCB ADDR
         STS,4    FPTC              SET DCB POINTR
         STS,4    FPTO              SET DCB POINTR
         STS,4    FPTR              SET DCB POINTR
         STS,4    FPTP              SET DCB POINTR
         LI,1     23                SET REL BA(ACS & ORG)      EL34674  START
         LB,1     *4,1              GET ORG & ACS              EL34674  START
         CI,1     X'21'             IF KEYED & SEQ FILE,       EL34674  START
         BE       GOREAD              JUMP TO READ             EL34674  START
,FPTC    M:CLOSE  DCB,(SAVE)
,FPTO    M:OPEN   0,(KEYED),(SEQUEN)
GOREAD   AI,15    1                                            EL34674  START
         LI,2     X'7FFFF'                                              START
         AND,2    *15               R2 = KEY ADDR
         AI,15    1
         AND,5    *15               R5 = KEY LENGTH ADDR
         LW,1     *5                R1 = KEY LENGTH
         LI,3     BA(KEYAREA)+1     R3 = DESTINATION ADDR
         STB,1    KEYAREA           STORE KEY LENGTH IN 1ST BYTE
         STB,1    3                 MOVE COUNT
         MBS,2    0
         LI,6     0                 ZERO R6 FOR C:ABA                   START
,FPTR    M:READ   0,(KEY,KEYAREA),(WAIT)
,FPTP    M:PRECORD 0,(REV)          BACK ONE RECORD
         LCI      9                 RESTORE R14 THRU R6                 START
         LM,14    SAVE16
         B        *RETURN
DCB      RES      1                 DUMMY DCB NAME
SAVE16   RES      9                 SAVE REGISTERS                      START
RETURN   RES      1
KEYAREA  RES      8
         CLOSE    KEYAREA,RETURN,SAVE16
         CLOSE    FPTC,FPTO,FPTR,FPTP
         END
