|
Hi Jorge, > Given a particular directory in the IFS, I want to change the ownership of > this diectory and any other object that belongs to this directory. > > I also want to introduce, (fix and/or amend) any previous > authorities/permissions defined against these objects I've got a CL program that I wrote that I use for this sort of thing. It's a one-time-use program that I keep around, and each time I modify the code so that it's ready for the new task. What this program does is call the QSHELL "find" command, asking it to output a list of all of the IFS objects that exist within a certain directory. It works recursively, so any subdirectories, and objects in them will also be included. You'll want to modify the loop in this example to use the CHGAUT or CHGOWN commands to set up the authority the way you want it. Here's my program: PGM /* warning: &MYLIB must be a valid library, and cannot + be QTEMP. */ DCL VAR(&MYLIB) TYPE(*CHAR) LEN(10) VALUE('SOMELIB') DCL VAR(&EOF) TYPE(*LGL) VALUE('0') DCL VAR(&MYLIB) TYPE(*CHAR) LEN(10) VALUE('SOMELIB') DCL VAR(&MYFILE) TYPE(*CHAR) LEN(10) VALUE('CHGOWNPF') DCL VAR(&IFSDIR) TYPE(*CHAR) LEN(200) DCL VAR(&IFSOUT) TYPE(*CHAR) LEN(55) DCL VAR(&CMD) TYPE(*CHAR) LEN(300) DCLF FILE(CHGOWNPF) /* XXX: CHANGE THIS TO THE SUBDIRECTORY TO WORK WITH: */ CHGVAR VAR(&IFSDIR) VALUE('/jsm/instance/uccnet') /* CREATE &MYFILE */ DLTF FILE(&MYLIB/&MYFILE) MONMSG CPF2105 CRTPF FILE(&MYLIB/&MYFILE) RCDLEN(1024) /* CREATE AN IFS PATHNAME FOR &MYFILE */ CHGVAR VAR(&IFSOUT) VALUE('/QSYS.LIB/' + *CAT &MYLIB *TCAT '.LIB/' + *CAT &MYFILE *TCAT '.FILE/' + *CAT &MYFILE *TCAT '.MBR') /* USE QSHELL TO PUT A LIST OF ALL OBJECTS IN &IFSDIR + (AND ANY SUBDIRECTORIES WITHIN) INTO &MYFILE */ CHGVAR VAR(&CMD) VALUE( + 'find ' *CAT &IFSDIR *TCAT ' > ' *CAT &IFSOUT) STRQSH CMD(&CMD) /* READ EACH FILENAME FROM &MYFILE AND CHANGE OWNERSHIP */ OVRDBF FILE(CHGOWNPF) TOFILE(&MYLIB/CHGOWNPF) LOOP: RCVF MONMSG MSGID(CPF0864) EXEC(CHGVAR &EOF VALUE('1')) IF (&EOF *NE '1') DO /* XXX: CHANGE THIS TO THE CORRECT CHGAUT/CHGOWN COMMAND */ CHGAUT OBJ(&CHGOWNPF) USER(*PUBLIC) DTAAUT(*RWX) + OBJAUT(*ALL) GOTO LOOP ENDDO DLTF FILE(&MYLIB/&MYFILE) ENDPGM
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.