          SUBROUTINE (SCRN.ID)
** Version# 14.0001[3] - 04/27/2014 - 08:48pm - TSMITH - eclipse
*** V14.0001 Change - Custom Coding . - 04/27/2014 - TSMITH - eclipse

*** SUBROUTINE: FKEYS.ALT.MAINT
*-------------------------------------------------------------------------*
***
*-------------------------------------------------------------------------*
          CHECK.KEY 'USER.DEFINED.ASSIGN',ENTRY,LVL
          IF NOT(ENTRY) THEN RETURN

          UT.OPEN.FILE 'UD.FORMS',UDFILE,ERR.MSG
          IF ERR.MSG THEN RETURN

          SCREEN
          VSCROLL.DEFINE 1,8,2,38,10
          VSCROLL.SET 1

          PASS.IDS  = "ORDER#,BT/PT,ST/SF,LI PN#,CUS/VEN,PN#,ACTIVE,NONE,"
          PASS.IDS := "OID~LDID,PIPELINE"
          CONVERT ',' TO VM IN PASS.IDS

          CTRL.ID = 'VALID.FKEYS.PROGRAMS'
          READ PGM.NAMES FROM CTRLFILE,CTRL.ID ELSE PGM.NAMES = ''


          SELECT UDFILE
          READLIST UD.FORMS ELSE UD.FORMS = ''
          SCRN.CNT = DCOUNT(UD.FORMS,AM)

          READ SCRNS FROM WORKFILE,'SCRN~':SCRN.ID ELSE SCRNS = ''
          GOSUB DISPLAY

          NAME = ''

          LINE=1; COL=1; LASTKEY=0; MOVE=0; QUIT=0
*-------------------------------------------------------------------------*
MOVENEXT: IF QUIT THEN GOTO FILEIT
          PARSEMOVE COL,LINE,2,10,10,YES
          ON COL GOTO IN.NAME,IN.PSID
*-------------------------------------------------------------------------*
IN.NAME:  INPV NAME,0,LINE,27,'MCU'
          IF CHANGED AND NAME # '' THEN
             IF NAME[1,2] = 'P:' THEN
                GOSUB VALIDATE.PROGRAM
             END ELSE
                GOSUB VALIDATE.SCREEN
             END
             IF NAME = '' THEN
                GOTO IN.NAME
                VPRINT 0,LINE,NAME "L#27"
             END
          END
          SCRNS<1,LINE> = NAME
          VPRINT 0,LINE,NAME "L#27"
          GOTO MOVENEXT
*-------------------------------------------------------------------------*
IN.PSID:  INPV WRK,30,LINE,8,V_'D:':PASS.IDS
          IF CHANGED THEN
             LOCATE WRK IN PASS.IDS<1> SETTING POS ELSE POS = 0
             SCRNS<2,LINE> = POS
          END
          GOTO MOVENEXT
*-------------------------------------------------------------------------*
DISPLAY:  FOR LINE = 1 TO 10
          GOSUB DISP.LN
          NEXT LINE
          RETURN
*-------------------------------------------------------------------------*
DISP.LN:  VPRINT  0,LINE,SCRNS<1,LINE>                    "L#27"
          IF SCRNS<2,LINE> THEN WRK = PASS.IDS<1,SCRNS<2,LINE>> ELSE WRK=''
          VPRINT 30,LINE,WRK                              "L#8"
          RETURN
*-------------------------------------------------------------------------*
VALIDATE.PROGRAM: *** loops through all valid program searching for
          *** match to what was entered.


          PGM.NAME = NAME[3,25]
          PGM.CNT  = DCOUNT(PGM.NAMES,AM)
          PGM.LIST = ''
          FOR PP = 1 TO PGM.CNT
             IF INDEX(PGM.NAMES<PP>,PGM.NAME,1) THEN
                PGM.LIST<-1> = PGM.NAMES<PP>
             END
          NEXT PP

          IF PGM.LIST = '' THEN NAME = ''; RETURN

          IF DCOUNT(PGM.LIST,AM) = 1 THEN
             NAME = 'P:':PGM.LIST<1>
          END ELSE
             RESULT = ''
             MENU.TABLE RESULT,8,2,1,5,25,'MCU',1,LOWER(PGM.LIST),'Valid Programs'
             NAME = 'P:':RESULT
          END

          RETURN
*-------------------------------------------------------------------------*
VALIDATE.SCREEN: *** loops through and looks for matches to what was
          *** entered.

          UD.CNT  = DCOUNT(UD.FORMS,AM)
          UD.LIST = ''
          FOR PP = 1 TO UD.CNT
             IF INDEX(UD.FORMS<PP>,NAME,1) THEN
                UD.LIST<-1> = UD.FORMS<PP>
             END
          NEXT PP

          IF UD.LIST = '' THEN NAME = ''; RETURN

          IF DCOUNT(UD.LIST,AM) = 1 THEN
             NAME = UD.LIST<1>
          END ELSE
             RESULT = ''
             MENU.TABLE RESULT,8,2,1,5,10,'MCU',1,LOWER(UD.LIST),'Valid Screens'
             NAME = RESULT
          END

          RETURN
*-------------------------------------------------------------------------*
FILEIT:   IF F12 THEN
             CONFIRM.ABORT SURE
             IF NOT(SURE) THEN GOTO IN.NAME
          END ELSE
             IF SCRN.ID # '' THEN
                WRITE SCRNS ON WORKFILE,'SCRN~':SCRN.ID
                EXECUTE 'BA /UDKEYSONLY SCREEN ':SCRN.ID
             END
          END
*-------------------------------------------------------------------------*
FINISH:   WINDOW.CLOSE
          RETURN
!TSMITH~04/27/14~20:48
