File 在openedge中编译目录中文件的程序

File 在openedge中编译目录中文件的程序,file,compilation,openedge,File,Compilation,Openedge,有人能帮我写一个程序,它必须编译目录中的所有文件并报告错误(如果有的话)。为此,我的程序必须获取文件夹下所有文件的列表及其完整路径,并将其存储在临时表中,然后它必须在临时表中循环并编译文件。下面是一个非常艰难的开始 在联机帮助(F1)中查找有关COMPILE语句和编译器系统句柄的更多信息 请注意,编译需要安装开发人员许可证。如果没有它,COMPILE语句将失败 DEFINE VARIABLE cDir AS CHARACTER NO-UNDO. DEFINE VARIABLE cFile AS

有人能帮我写一个程序,它必须编译目录中的所有文件并报告错误(如果有的话)。为此,我的程序必须获取文件夹下所有文件的列表及其完整路径,并将其存储在临时表中,然后它必须在临时表中循环并编译文件。

下面是一个非常艰难的开始

在联机帮助(F1)中查找有关COMPILE语句和编译器系统句柄的更多信息

请注意,编译需要安装开发人员许可证。如果没有它,COMPILE语句将失败

DEFINE VARIABLE cDir  AS CHARACTER NO-UNDO.
DEFINE VARIABLE cFile AS CHARACTER NO-UNDO FORMAT "x(30)".

ASSIGN
    cDir = "c:\temp\".

INPUT FROM OS-DIR(cDir).
REPEAT:
    IMPORT cFile.

    IF cFile MATCHES "*..p" THEN DO:
        COMPILE VALUE(cDir + cFile) SAVE NO-ERROR.
        IF COMPILER:ERROR THEN DO:
            DISPLAY 
                cFile 
                COMPILER:GET-MESSAGE(1) FORMAT "x(60)" 
                WITH FRAME frame1 WIDTH 300 20 DOWN.         
        END.
    END.
END.
INPUT CLOSE. 

因为评论不允许我在里面贴这么多。。。使用OS-DIR的输入返回目录下的所有文件和目录。您可以使用此信息继续沿着目录树查找所有子目录

OS-DIR documentation:

Sometimes, rather than reading the contents of a file, you want to read a list of the files in a directory. You can use the OS–DIR option of the INPUT FROM statement for this purpose.

Each line read from OS–DIR contains three values: 
*The simple (base) name of the file.
*The full pathname of the file.
*A string value containing one or more attribute characters. These characters indicate the type of the file and its status.

Every file has one of the following attribute characters:
*F — Regular file or FIFO pipe
*D — Directory
*S — Special device
*X — Unknown file type

In addition, the attribute string for each file might contain one or more of the following attribute characters:

*H — Hidden file
*L — Symbolic link
*P — Pipe file

The tokens are returned in the standard ABL format that can be read by the IMPORT or SET statements.

养成一种习惯,至少先尝试一下,然后把你尝试过的东西贴出来。这里的人们想要的是帮助,但他们也喜欢表现出的努力!