Hi All,
I am trying to write a program that will search all the files in a directory(&PATH) for a string(&SEARCH). The program is supposed to return the name of all the files that contain the string. Here's what I have so far. I tried running the program but STDOUT turns out empty even when I know there is at least one file with the string I am looking for. Am I missing something?
I am trying to write a program that will search all the files in a directory(&PATH) for a string(&SEARCH). The program is supposed to return the name of all the files that contain the string. Here's what I have so far. I tried running the program but STDOUT turns out empty even when I know there is at least one file with the string I am looking for. Am I missing something?
Code:
PGM (&PATH &SEARCH &ERROR)
DCL &PATH *CHAR LEN(21)
DCL &SEARCH *CHAR LEN(24)
DCL &ERROR *CHAR LEN(10)
DCL &CMD *CHAR LEN(100)
DCL "E *CHAR LEN(1) VALUE('''')
CHGVAR &ERROR VALUE(' ')
CD DIR(&PATH)
MONMSG MSGID(CPFA09C) EXEC(DO)
CHGVAR &ERROR VALUE('NOT_AUTH')
RETURN
ENDDO
CHGVAR &CMD VALUE('grep -l -i ' !! "E !! &SEARCH !! "E)
CLRPFM QTEMP/STDOUT
MONMSG MSGID(CPF0000)
OVRDBF FILE(STDOUT) TOFILE(QTEMP/STDOUT) OVRSCOPE(*CALLLVL)
QSH CMD(&CMD)
DLTOVR FILE(STDOUT) LVL(*)
ENDPGM




Comment