[progress Communities] [progress Openedge Abl] Forum Post: Geeting Attempt To Read From...

  • Thread starter Thread starter Krishna Kumar
  • Start date Start date
Status
Not open for further replies.
K

Krishna Kumar

Guest
Hi , I have written below program in order to take data from .csv file and search whether the specific word(present in .csv) is available in all .p/w / .I files which are present in a specific directory. In case word is present then I'm outputting current directory, current file and line number to other.csv file. However once I run it I'm getting below error - " Attempt to read from closed stream Datafile(1386) Error "" . Can you plese check and let me know how to resolve the same. Attached is the .csv file. Below is the code - DEFINE VARIABLE cDirectoryList 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 DirStream. DEFINE STREAM FileStream. DEFINE STREAM ReportStream. DEFINE STREAM Datafile. /* kk */ ASSIGN cDirectoryList = "E:\kk". DO iCounterVariable = 1 TO NUM-ENTRIES(cDirectoryList): ASSIGN cCurrentDiretory = ENTRY(iCounterVariable, cDirectoryList). INPUT STREAM DirStream FROM OS-DIR( cCurrentDiretory). REPEAT: IMPORT STREAM DirStream cCurrentFile. IF LENGTH(cCurrentFile) 0 THEN NEXT. iInnerLineCounter = iOuterLineCounter. DO WHILE SUBSTRING(cStatement, LENGTH(cStatement)) <> '.' AND SUBSTRING(cStatement, LENGTH(cStatement)) <> ':': IMPORT STREAM FileStream UNFORMATTED cLine. iInnerLineCounter = iInnerLineCounter + 1. cStatement = cStatement + " " + TRIM(cLine). END. /* DO WHILE */ iOuterLineCounter = iInnerLineCounter. PUT STREAM ReportStream UNFORMATTED ipcCurrentDiretory AT 1 ipcCurrentFile AT 52 iOuterLineCounter AT 104 cStatement AT 110 SKIP. END. /* REPEAT */ END . /* kkstream */ INPUT STREAM FileStream CLOSE. OUTPUT STREAM ReportStream CLOSE. /* INPUT STREAM Datafile CLOSE. */ END PROCEDURE.

Continue reading...
 
Status
Not open for further replies.
Back
Top