Good morning, Progress gurus:
I have a need to install logic at the top of a program that will search for a file on a directory using 'begins' logic (since the filename changes daily by virtue of a date-stamping extension), and if that file is found, exit the program. Do any of you know how to accomplish this using a simple Unix script? I am currently employing this Progress logic (which works, but I would think this could be handled in smarter fashion):
/* FILE-SEEKER BLOCK *********************************/
def var v-file as char format 'x(60)' no-undo.
def var v-path as char format 'x(60)' no-undo.
def stream s-in.
assign
v-path = '/nfs2/Int6_*' (where Int6 is the beginning of the filename)
v-file = ''.
input stream s-in through l value(v-path) no-echo.
import stream s-in unformatted v-file.
input close.
if not r-index(substr(v-file,length(v-file) - 8),'not found') <> 0
then do:
message color message
skip(1)
'UNPROCESSED FILE NAME(S): ' v-file
skip(1)
view-as alert-box
title ' File(s) Found '.
return.
end.
else do:
message 'continue processing'
view-as alert-box.
end.
/* END FILE-SEEKER BLOCK *****************************/
Thanks in advance for your expertise.
Dave (dstrasin)
I have a need to install logic at the top of a program that will search for a file on a directory using 'begins' logic (since the filename changes daily by virtue of a date-stamping extension), and if that file is found, exit the program. Do any of you know how to accomplish this using a simple Unix script? I am currently employing this Progress logic (which works, but I would think this could be handled in smarter fashion):
/* FILE-SEEKER BLOCK *********************************/
def var v-file as char format 'x(60)' no-undo.
def var v-path as char format 'x(60)' no-undo.
def stream s-in.
assign
v-path = '/nfs2/Int6_*' (where Int6 is the beginning of the filename)
v-file = ''.
input stream s-in through l value(v-path) no-echo.
import stream s-in unformatted v-file.
input close.
if not r-index(substr(v-file,length(v-file) - 8),'not found') <> 0
then do:
message color message
skip(1)
'UNPROCESSED FILE NAME(S): ' v-file
skip(1)
view-as alert-box
title ' File(s) Found '.
return.
end.
else do:
message 'continue processing'
view-as alert-box.
end.
/* END FILE-SEEKER BLOCK *****************************/
Thanks in advance for your expertise.
Dave (dstrasin)