If the file name contains a date. Create a variable with the constant (i.e. ABCxxxxxx). You can do it one of two ways (chgvar &filename (‘ABC’ || &date)) or (chgvar substr(&filename,4,6) &date). Use the variable (&filename) in you copy statement.
If you have Qshell installed, try experimenting with something like this:<pre>
crtdtaara MYLS *char 32
qsh cmd(‘ls | datarea -w -l MYLS’)
dspdtaara MYLS</pre>Note that the “pipe” character between the ls and datarea utilities will need to be the appropriate pipe character for your system. Right now, my emulator sessions require using “!”.
There are far better ways of doing this, but you need something simple for now. What I coded is simply to give you an example to see if it can be adapted. You ought to be able to copy/paste those commands onto a command line (watching the “pipe”.)
The code creates a basic *char(32) data area in the current library — pick a library you prefer, set the size you need. The STRQSH commands then list (ls) the current directory to standard out, which is piped into the datarea utility, which writes (-w) lines to the MYLS data area found in the library list (-l). You can then display the data area to see what’s there. In a CL program, you’d use RTVDTAARA rather than DSPDTAARA of course.
If you try variations of ls, you can choose the path that you want to list and set a pattern to select which files to list. If there’s only and always just a single file, then you probably won’t have to worry much.
It’s not very sophisticated. I didn’t think you needed anything but the basics. It should be easy enough to adapt for various purposes.