View previous topic :: View next topic
|
Author |
Message |
maheshk84
New User
Joined: 04 Jan 2006 Posts: 22 Location: Chennai
|
|
|
|
Hi All, My mainframe team does a lot of testing and for that purpose we need to create test GDGs. The GDG creation job is done manually.
While reviewing we always find out that few GDG names will be incorrect. Like production GDGs are mentioned and JCL scan (!JCK) does not identify it..
Code: |
VIEW X11421.REINS.JCLS(G5R01GDG) - 01.28 LAST CC WAS 00
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
==MSG> CAY6000 1 STATEMENT FLAGGED IN JOB "G5R01GDG" MAXIMUM SEVERITY WAS 0
==MSG>
==MSG>
==MSG>
000001 //G5R01GDG JOB (5R01,5R01),PROD,CLASS=A,MSGCLASS=J,
000002 // REGION=2048K,MSGLEVEL=(1,1),USER=H5R01
000003 /*JOBPARM ROOM=OVER,S=04A8
000004 //*********************************************************************
000005 //JOBLIB DD DSN=PRODPLS.SARE.LOAD,DISP=SHR
000006 // DD DSN=PRODPLS.SARC.LOAD,DISP=SHR
000007 //*********************************************************************
000008 //STEP00 EXEC PGM=IDCAMS
==MSG> //STEP00 EXEC PGM=IDCAMS
==MSG> CAY6092I JOBLIB/STEPLIB NOT REQUIRED FOR PROGRAM "IDCAMS"
==MSG>
000009 //SYSPRINT DD SYSOUT=*
000010 //SYSIN DD *
000011 DEFINE GDG(NAME(A.ERCE0102.BACKUP) -
000012 LIMIT(24) SCRATCH)
000013 /*
|
So, I created a GDGCHK macro which works fine as shown below
Code: |
VIEW X11421.REINS.JCLS(G5R01GDG) - 01.28 Pls chk the job
Command ===> Scroll ===> CSR
****** ***************************** Top of Data ******************************
000001 //G5R01GDG JOB (5R01,5R01),PROD,CLASS=A,MSGCLASS=J,
000002 // REGION=2048K,MSGLEVEL=(1,1),USER=H5R01
000003 /*JOBPARM ROOM=OVER,S=04A8
000004 //*********************************************************************
000005 //JOBLIB DD DSN=PRODPLS.SARE.LOAD,DISP=SHR
000006 // DD DSN=PRODPLS.SARC.LOAD,DISP=SHR
000007 //*********************************************************************
000008 //STEP00 EXEC PGM=IDCAMS
000009 //SYSPRINT DD SYSOUT=*
000010 //SYSIN DD *
000011 DEFINE GDG(NAME(A.ERCE0102.BACKUP) -
==MSG> GDG INDEX A.ERCE0102.BACKUP ALREADY EXISTS
000012 LIMIT(24) SCRATCH)
000013 /*
|
but the SYSDSN parameter recalls all the migrated versions of the GDG. Hence, consuming more time. The code is provided below.
Code: |
/*--------------------------- REXX -----------------------------------*/
/* REXX MACRO : GDGCHK */
/* AUTHOR : CTS. JULY 2011. */
/* PURPOSE : TO CHECK THE EXISTENCE OF ALL THE GDGS IN THE JCL */
/*--------------------------------------------------------------------*/
ADDRESS ISREDIT
"MACRO PROCESS"
/* ------------------------------------------------------------ */
/* LOOP THROUGH THE JOB */
"(CURRLN) = LINENUM .ZCSR" /* CURRENT LINE */
"(LASTLN) = LINENUM .ZLAST" /* LAST LINE NUMBER */
I = 0
GDG_EXIST_CNT = 0
DO FOREVER
I = I + 1
IF I > LASTLN THEN LEAVE
"(LINE) = LINE " I
LINE = SUBSTR(LINE,1,72)
WORD1 = SUBWORD(LINE,1,1)
WORD2 = SUBWORD(LINE,2,1)
UPPER WORD1 WORD2
PARSE VAR WORD2 'GDG(NAME('DSN')'
IF WORD1 \= 'DEFINE' & WORD2 \= 'GDG' THEN ITERATE
CALL CHECK_GDG
END
ADDRESS ISPEXEC
IF GDG_EXIST_CNT = 0 THEN DO
ZEDSMSG = " GDGs Ok "
END
ELSE DO
ZEDSMSG = " Pls chk the job "
END
"SETMSG MSG(ISRZ001)"
EXIT 0
/* ------------------------------------------------------------ */
CHECK_GDG:
/* CHECK IF GDG EXISTS */
ADDRESS TSO
DSN = STRIP(DSN)
RC = SYSDSN("'"DSN"'")
/* IF GDG FOUND */
IF (RC = 'OK') THEN DO
GDG_EXIST_CNT = GDG_EXIST_CNT + 1
MSG = "'GDG INDEX" DSN "ALREADY EXISTS'"
"ISREDIT LINE_AFTER " I "= MSGLINE" MSG
RETURN
END
RETURN
|
Please let me know if there is any solution to just check the existence of the GDG base without recalling its migrated versions. Tried LISTDSI as well but not working.[/code] |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
One way might be using a LISTCAT. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Code: |
/* Rexx */
/* Written Heisei 23.8.19 by Akatsukami-sama */
trace o
arg dsn .
myrc = 0
x = outtrap("LISTC.")
"LISTCAT ENTRIES('"dsn"')"
x = outtrap("OFF")
do i = 1 to listc.0
if (pos("GDG BASE",listc.i)¬=0) then myrc = 1
end
return myrc |
|
|
Back to top |
|
|
maheshk84
New User
Joined: 04 Jan 2006 Posts: 22 Location: Chennai
|
|
|
|
Thanks Dick and Akatsukami. The macro worked fine with LISTCAT. My CHECK_GDG routine modified as shown below.
Code: |
/* ------------------------------------------------------------ */
CHECK_GDG:
/* CHECK IF GDG EXISTS */
ADDRESS TSO
DSN = STRIP(DSN)
X = OUTTRAP("LISTC.")
"LISTCAT ENTRIES('"DSN"')"
X = OUTTRAP("OFF")
DO J = 1 TO LISTC.0
IF (POS("GDG BASE",LISTC.J)¬=0) THEN DO
GDG_EXIST_CNT = GDG_EXIST_CNT + 1
MSG = "'GDG INDEX" DSN "ALREADY EXISTS'"
"ISREDIT LINE_AFTER " I "= MSGLINE" MSG
LEAVE
END
END
RETURN
/* ============================================================ */
|
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know
d |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
maheshk84,
The code works, but
had you implemented Akatsukami's suggestion as he gave it
a separate, CALLed Script,
you would have had- a routine that could be called by any script
- less code in your current script
reusable code is a habit you should develop. |
|
Back to top |
|
|
maheshk84
New User
Joined: 04 Jan 2006 Posts: 22 Location: Chennai
|
|
|
|
Thanks for the suggestion dbzTHEdinosauer. I will modify my code accordingly. |
|
Back to top |
|
|
|