有如下Directory,其中ppp作为输入参数,是工厂代码。
/apps/elf/ppp
/apps/elf/ppp/aod
/apps/elf/ppp/ship
/apps/elf/ppp/shipresp
/apps/elf/ppp/wo
/apps/elf/ppp/vendorrequest
/apps/elf/ppp/archive/aod
/apps/elf/ppp/archive/ship
/apps/elf/ppp/archive/shipresp
/apps/elf/ppp/archive/wo
/apps/elf/ppp/archive/vendorrequest
.....
要对其上面的Directory做如下操作。
CRTDIR
DIR('/apps/elf/9E4/')
CHGAUT OBJ('/apps/elf/9E4') USER(*PUBLIC)
DTAAUT(*RX) SYMLNK(*NO)
CHGAUT OBJ('/apps/elf/9E4') AUTL(JAVAPGMR)
SYMLNK(*NO)
CHGOWN OBJ('/apps/elf/9E4') NEWOWN(PGMR)
方法有很多种
1.最笨的方法就是一个一个
2.使用dofor + select
3.在cl中使用file
4.使用rexx
第一种在这里就不多说了。
第二种的结构如下
dcl &path *char 50
dofor var(&count) from(1) to (40)
chgvar &path '/app/elf/ '
select
when (&count *eq 1) then(chgvar &path &path *tcat &plom
when (&count *eq 2) then(chgvar &path &path *tcat &plom *tcat /aod
.....
endselect
CRTDIR
DIR(&path)
MONMSG(CPFA0A0) EXEC(ITERATE) /* OBJECT ALREADY EXISTS, NEXT LOOP */
CHGAUT OBJ(&path) USER(*PUBLIC)
DTAAUT(*RX) SYMLNK(*NO)
CHGAUT OBJ(&path) AUTL(JAVAPGMR)
SYMLNK(*NO)
CHGOWN OBJ(&path) NEWOWN(PGMR)
enddo
第三种方法
建一个file,名字为dirfile,有一个字段,名为dir,KEY为dir。把ppp后面的目录添加到文件中。
dirfile的记录如下:
(blank)
/aod
/ship
/shipresp
/wo
/vendorrequest
/archive/aod
/archive/ship
/archive/shipresp
/archive/wo
/archive/vendorrequest
.....
cl就变成如下
PGM PARM(&PLOM)
DCL VAR(&PLOM) TYPE(*CHAR) LEN(3)
DCL VAR(&ELFPATH) TYPE(*CHAR) LEN(10) VALUE('/apps/elf/')
DCL VAR(&STARTPATH) TYPE(*CHAR) LEN(16)
DCL VAR(&ENDPATH) TYPE(*CHAR) LEN(23)
DCL VAR(&FULLPATH) TYPE(*CHAR) LEN(39)
DCLF FILE(ptrlib/dirfile)
/* gets starting path which is elf directory and plom together */
CHGVAR VAR(&STARTPATH) VALUE(&ELFPATH *TCAT &PLOM)
LOOP: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
/* End path from file */
CHGVAR VAR(&ENDPATH) VALUE(&dir)
CHGVAR VAR(&FULLPATH) VALUE(&STARTPATH *TCAT &ENDPATH)
CRTDIR DIR(&FULLPATH)
MONMSG MSGID(CPFA0A0) EXEC(GOTO CMDLBL(LOOP))
/* Authority on all directories */
CHGAUT OBJ(&FULLPATH) USER(*PUBLIC) DTAAUT(*RX) SYMLNK(*NO)
CHGAUT OBJ(&FULLPATH) AUTL(JAVAPGMR) SYMLNK(*NO)
CHGOWN OBJ(&FULLPATH) NEWOWN(PGMR)
GOTO CMDLBL(LOOP) /* NEW VALUE */
ENDPGM: ENDPGM
第四种方法
Address Command
Parse Arg plom
/* Build all IFS Directory to variable path. */
path.1 ='/mfgapps/elf/'||strip(plom)
path.2 ='/mfgapps/elf/'||strip(plom)||'/archive'
path.3 ='/mfgapps/elf/'||strip(plom)||'/aod'
path.4 ='/mfgapps/elf/'||strip(plom)||'/bawo'
path.5 ='/mfgapps/elf/'||strip(plom)||'/baworesp'
path.6 ='/mfgapps/elf/'||strip(plom)||'/fodcoderesp'
path.7 ='/mfgapps/elf/'||strip(plom)||'/fodkey'
path.8 ='/mfgapps/elf/'||strip(plom)||'/fodkeyresp'
path.9 ='/mfgapps/elf/'||strip(plom)||'/hawb'
path.10 ='/mfgapps/elf/'||strip(plom)||'/incoinv'
path.11 ='/mfgapps/elf/'||strip(plom)||'/pinv'
path.12 ='/mfgapps/elf/'||strip(plom)||'/preship'
path.13 ='/mfgapps/elf/'||strip(plom)||'/preshipresp'
。。。
path.40 ='/mfgapps/elf/'||strip(plom)||'/wo/filter'
path.0 = 40
/* Read all IFS Directory, then create it , change authority and owner. */
/* path.0 contains the total number of path returned, while path.1...path.n */
/* contains the output for each individual path. */
Do i = 1 To path.0
"CRTDIR DIR('"||path.i||"')"
If RC == 'CPFA0A0' Then
ITERATE
"CHGAUT OBJ('"||path.i||"') USER(*PUBLIC) DTAAUT(*RX) SYMLNK(*NO)"
"CHGAUT OBJ('"||path.i||"') AUTL(JAVAPGMR) SYMLNK(*NO)"
"CHGOWN OBJ('"||path.i||"') NEWOWN(PGMR)"
End
Exit
阅读(1453) | 评论(0) | 转发(1) |