Next question is are you familiar with UNIX commands?
You can manipulate files in the IFS using QSHELL commands – which are basically UNIX. (or UNIX-like)
For example you can get a directory listing and redirect it to a file in QSYS using a command like
ls - l ifspath > qsyspath
where ifspath is formatted like dirname/dirname
and qsyspath is formatted like qsys.lib/libname.lib/filename.fil/mbrname.mbr
Put the whole thing in a variable like &SHELCMD and then you execute it in CL using
Of course, then you have to parse the resulting file and determine what IFS files you need to change.
If it’s individual records you are looking at, it gets more complicated. You can use the CPYFRMSTMF command to copy an IFS file to a QSYS file, modify the file as needed and then use CPYTOSTMF to put it back.
Oh.. that should be
(too many fingers….)
I do not have the idea of UNIX. Can we do this using CL commands??
You could create an RPG program which uses some of the C runtime library functions (lstat, opendir, readdir, and closedir) to get a list of the files in the specified IFS directory, which could direct its output to a file. You could then create a command for that program that could be initiated from your CL.
(I downloaded a utility for this a while back, IFS Tools, that was created by Peter Connell. I don’t have the link anymore of where I got it, but I bet you could search and find it or something similar.)
Then you could read that output file in your CL program, determine which files you want to delete, and use the DEL command to delete the specific files.
Can we do this using CL commands??
If you are running V5R4 or later, yes.
Then you just write your CL like it was a C program or ILE RPG or COBOL. Of course, if you’re going to try to do that, the programming will be much easier in C or RPG, so why do it in CL?