      SUBROUTINE PLW.GET.DSG.FILES(DSGNAME,PATH,OPT,RESULT)
*PIC-LAN
*
*TEST
*PC
*Y
*
*
*
*
      CALL PLSUB.DSG('*OPEN CONNECTION',PLCB.HANDLE,DSG.NAME,'','','','','','')
*
      IF INDEX(OPT,'S',1) THEN
         DIR.OPT = 'ND'
      END ELSE
         DIR.OPT = 'N'
      END
*
      DIR.LIST = '/'
      RESULT = ''
      LOOP WHILE DIR.LIST <> '' DO
         CALL PLSUB.DSG('*DOS DIR',PLCB.HANDLE,PATH:DIR.LIST<1>:'*.*',DIR.OPT,'','','',DTA,'')
         FOR I = 1 TO DCOUNT(DTA,AM)
            BEGIN CASE
               CASE INDEX(DTA<I,3>,'D',1)
                  IF (DTA<I,1>)[1,1] <> '_' AND DTA<I,1> <> '.' AND DTA<I,1> <> '..' THEN
                     DIR.LIST<-1> = DIR.LIST<1> : DTA<I,1> : '/'
                  END
               CASE INDEX(DTA<I,3>,'N',1)
                  RESULT<-1> = DIR.LIST<1>[2,999] : DTA<I,1>
            END CASE
         NEXT I
         DIR.LIST = DELETE(DIR.LIST,1,0,0)
      REPEAT
*
      CALL PLSUB.DSG('*CLOSE CONNECTION',PLCB.HANDLE,'','','','','','','')
*
      RETURN
   END
