Create Missing GDG's in JCL
MEMBER NAME CRE8GDG
/* REXX */
/*--------------------------------------------------------------------*/
/* */
/* PURPOSE : To create the missing GDG bases in the JCL */
/* */
/* HOW TO USE : After building/modifing the JCL (job), just go */
/* inside the job and give 'JJ'. It will show all */
/* the missing GDG bases.Later type 'MD9999' to */
/* make them display, then type the command */
/* 'CRE8GDG' in the command line. */
/* */
/* GDG PROPERTIES : GDG Base Limt : 10 */
/* NO EMPTY */
/* SCRATCH */
/* */
/* */
ADDRESS ISREDIT
"MACRO"
/*---------------- below code is to capture JCL part ---------------*/
/*------------------ which will be re-written later ----------------*/
cnt=0
"ISREDIT (lastl) = LINENUM .ZLAST"
do curr=1 to lastl
"ISREDIT (datal) = LINE" Curr
if substr(datal,1,2) = "//" then
do
if substr(datal,1,25) = "// " then
do
end
else
do
cnt=cnt+1
if index(datal,"&") \= 0 then
do
datal= translate(datal,"›","&")
y.cnt=datal
end
y.cnt=datal
end
end
if substr(datal,1,2) = "/*" then
do
cnt=cnt+1
y.cnt=datal
end
end
"X all"
"f all '4 DSS20091W'"
"f all ''x'"
"del all x"
"x all"
"f all 'gdg base'"
"f all ' ' 1"
"del all x"
"x all"
"f all ''x'"
"del all x"
"ISREDIT (lastline) = LINENUM .ZLAST"
IF lastline \= 0 THEN
DO
DO Curr=1 TO lastline
"ISREDIT (dataline) = LINE" Curr
IF INDEX(dataline,'DDNAME') \= 0 THEN
DO
PARSE VAR dataline some ','some1"'"gdg"'"
END
ELSE
DO
PARSE VAR dataline some "'"gdg"'"
END
PARSE VAR gdg gdg ' '
RESULT = SYSDSN("'"gdg"'")
IF RESULT /= OK THEN
DO
ADDRESS TSO
x = OUTTRAP(n.)
"DEF GDG (NAME('"gdg"') LIM(10) NEMP SCR)"
x = OUTTRAP(OFF)
END
END
END
/*---------------- below code rewrite the jcl back -----------------*/
ADDRESS ISREDIT
"x all"
"del all x"
do x=1 to cnt
job.x=strip(y.x)
w=x-1
ln.x='"LINE_AFTER '³³w³³' ="'
address "ISREDIT" "LINE_AFTER "w"= " '"'job.x'"'
end
ADDRESS ISREDIT
"c all '›' '&'"
"res"
"f all '//' 1"
/*---------------- below code is to diplay message -----------------*/
ADDRESS ISPEXEC
ZEDSMSG = ''
ZEDLMSG = '*** All GDG Base(s) has been created Successfully!!! ***'
'SETMSG MSG(ISRZ001)';
EXIT
/* REXX */
/*--------------------------------------------------------------------*/
/* */
/* PURPOSE : To create the missing GDG bases in the JCL */
/* */
/* HOW TO USE : After building/modifing the JCL (job), just go */
/* inside the job and give 'JJ'. It will show all */
/* the missing GDG bases.Later type 'MD9999' to */
/* make them display, then type the command */
/* 'CRE8GDG' in the command line. */
/* */
/* GDG PROPERTIES : GDG Base Limt : 10 */
/* NO EMPTY */
/* SCRATCH */
/* */
/* */
ADDRESS ISREDIT
"MACRO"
/*---------------- below code is to capture JCL part ---------------*/
/*------------------ which will be re-written later ----------------*/
cnt=0
"ISREDIT (lastl) = LINENUM .ZLAST"
do curr=1 to lastl
"ISREDIT (datal) = LINE" Curr
if substr(datal,1,2) = "//" then
do
if substr(datal,1,25) = "// " then
do
end
else
do
cnt=cnt+1
if index(datal,"&") \= 0 then
do
datal= translate(datal,"›","&")
y.cnt=datal
end
y.cnt=datal
end
end
if substr(datal,1,2) = "/*" then
do
cnt=cnt+1
y.cnt=datal
end
end
"X all"
"f all '4 DSS20091W'"
"f all ''x'"
"del all x"
"x all"
"f all 'gdg base'"
"f all ' ' 1"
"del all x"
"x all"
"f all ''x'"
"del all x"
"ISREDIT (lastline) = LINENUM .ZLAST"
IF lastline \= 0 THEN
DO
DO Curr=1 TO lastline
"ISREDIT (dataline) = LINE" Curr
IF INDEX(dataline,'DDNAME') \= 0 THEN
DO
PARSE VAR dataline some ','some1"'"gdg"'"
END
ELSE
DO
PARSE VAR dataline some "'"gdg"'"
END
PARSE VAR gdg gdg ' '
RESULT = SYSDSN("'"gdg"'")
IF RESULT /= OK THEN
DO
ADDRESS TSO
x = OUTTRAP(n.)
"DEF GDG (NAME('"gdg"') LIM(10) NEMP SCR)"
x = OUTTRAP(OFF)
END
END
END
/*---------------- below code rewrite the jcl back -----------------*/
ADDRESS ISREDIT
"x all"
"del all x"
do x=1 to cnt
job.x=strip(y.x)
w=x-1
ln.x='"LINE_AFTER '³³w³³' ="'
address "ISREDIT" "LINE_AFTER "w"= " '"'job.x'"'
end
ADDRESS ISREDIT
"c all '›' '&'"
"res"
"f all '//' 1"
/*---------------- below code is to diplay message -----------------*/
ADDRESS ISPEXEC
ZEDSMSG = ''
ZEDLMSG = '*** All GDG Base(s) has been created Successfully!!! ***'
'SETMSG MSG(ISRZ001)';
EXIT
Comments
Post a Comment