I am receiving a file daily in an IFS directory, I manually copy the file to a library using the CPYFRMSTMF command. I want to automate the process so that it will be done every day at a specific time. The challenge is that the file name in the IFS directory is different every day, for example it is ABC121206 today and ABC121306 tomorrow and the CPYFRMSTMF cannot take a generic value such as ABC*. Is there a process or API that would rename the file to a generic name in the IFS so that the CPYFRMSTMF command would use that name every days?
Thanks
Software/Hardware used:
ASKED:
December 14, 2006 3:53 PM
UPDATED:
December 26, 2009 1:34 AM
If you need the process to be more forgiving you can create a list of the file names in the IFS folder and populate a physical file with the results. Then run a program to use CPYFRMSTMF for each filename in your physical file. Here is some sample CL code to create the physical file with the list of filenames in the IFS the reason for filelist2 is this PF has the field name in it.
CLRPFM FILE(mylib/FILELIST) QSH CMD(‘(LS /IFSfoldername>/QSYS.LIB/mylib.LIB/FILELIST.FILE/FILELIST.MBR)’)
CPYF FROMFILE(mylib/FILELIST) TOFILE(mylib/FILELIST2) MBROPT(*REPLACE) FMTOPT(*NOCHK)