Kbase P19325: How to compile all the .p files from a list of directories and save the resulting .r files in a spec
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  27/05/2009 |
|
Status: Verified
GOAL:
How to compile all the .p files from a list of directories and save the resulting .r files in a specified target directory.
GOAL:
How to compile all files from a directory using 4GL?
GOAL:
How to import OS-DIR function results to a stream and compile those files?
FIX:
/**************************************************************************************************
This code compiles all the .p files found in a list of directories and saves the resulting .r files in the specified target directory.
***************************************************************************************************/
DEFINE VARIABLE cDirectoryList AS CHARACTER NO-UNDO.
DEFINE VARIABLE cTargetDiretory AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCurrentDiretory AS CHARACTER NO-UNDO.
DEFINE VARIABLE cCurrentFile AS CHARACTER NO-UNDO.
DEFINE VARIABLE iCounterVariable AS INTEGER NO-UNDO.
DEFINE STREAM myStream.
ASSIGN
cDirectoryList = "D:\PROGRESS\FirstDir" + "," + "D:\PROGRESS\SecondDir"
cTargetDiretory = "D:\PROGRESS\RcodeDir".
DO iCounterVariable = 1 TO NUM-ENTRIES(cDirectoryList):
ASSIGN
cCurrentDiretory = ENTRY(iCounterVariable, cDirectoryList).
INPUT STREAM myStream FROM OS-DIR( cCurrentDiretory).
REPEAT:
/* Get the current directory's .p files only */
/* Compile and save in the target directory */
IMPORT STREAM myStream cCurrentFile.
IF LENGTH(cCurrentFile) < 3 THEN NEXT.
IF cCurrentFile MATCHES "*~~.p" THEN
COMPILE VALUE(cCurrentFile) SAVE INTO VALUE(cTargetDiretory).
END.
END.