分类: 系统运维
2011-10-14 14:51:49
我们可以使用LISTCAT来判断GDG base是不是存在,如果rc的返回值为0就证明此GDG base是存在的。例子如下:
GDG = "c210408.gdg.base"
X=OUTTRAP(LST.)
"LISTC ENT('"GDG"')"
X=OUTTRAP(OFF)
if rc <> 0 then
say 'gdg not exist'
还可以在定义GDG base的时候来判断,例子如下:
DDNAME = "'C210408.GDG.BASE'"
x = Outtrap(n.)
"def gdg(name("ddname") LIM(3) SCR)"
x = Outtrap(Off)
Do i = 1 To n.0
err = Pos("DUPLICATE DATA SET NAME",n.i)
If err <> 0 Then Say "This GDG already exists"
End
要想删除整个GDG必须先删除他的各个Generation。而后在删除GDG base。例子如下:
GDG = 'C210408.GDG.BASE'
X=OUTTRAP(LST.)
"LISTC ENT('"GDG"')"
X=OUTTRAP(OFF)
Do A = LST.0 TO 1 BY -1
If Pos('NONVSAM',LST.A) > 0 Then Do
"DELETE '" || STRIP(SUBSTR(LST.A,17,50)) || "' PURGE"
End
End
"DELETE '" || GDG || "' GDG PURGE"
Exit 0