|
Hi Craig, > I plan on doing the open and probably wrapping it separately and making a > command like CLRLNK. That way, others could use it from their CL easily. > By clearing the files we will ensure that we don't pull previous data > populated by software. Heh.. don't call it "CLRLNK" (Clear Link)... you're not clearing the link, you're clearing the data that it points to. You see, the way the IFS works is that each filename in a directory is called a "link" because that filename is linked to some data. It's possible to have many different filenames in different directories that all point to the same data on disk. For example, let's say that I create a file in my home directory: EDTF '/home/klemscot/SystemDefault.properties' Then I decide that everyone should be able to use my file, so I make a link: ADDLNK OBJ('/home/klemscot/SystemDefault.properties') + NEWLNK('/QIBM/UserData/Java400/SystemDefault.properties') + LNKTYPE(*HARD) Now, if I edit either the /QIBM copy, or the /home/klemscot copy, the changes go to both places. If I clear one, both are cleared. Why? Because what we have here is one file with two links to it. If I use the unlink() API or RMVLNK command to delete either one of those links, the data remains intact. c callp unlink('/home/klemscot' + c '/SystemDefault.properties') After executing that, there's no longer a link to that file from /home/klemscot. However, the file is still there, and there's still a link in /QIBM/UserData/Java400. When I delete the SECOND copy of the data, however: RMVLNK OBJLNK('/QIBM/UserData/Java400/SystemDefault.properties') Now the actual file data is removed, because this was the last link to that data... The point of all of this is to understand the difference between a LINK (as in WRKLNK, RMVLNK, ADDLNK, etc) and the file's data (as in EDTF, DSPF, CPY, etc) When you clear the data with open() (and don't forget to do a close() as well!) you're clearing the file's data rather than the link. So, call your command "CLRF" rather than "CLRLNK" or I'll laugh at you :)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.