IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem with SYSDSN parameter for GDGs


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Fri Aug 19, 2011 9:41 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 19, 2011 9:54 pm
Reply with quote

Hello,

One way might be using a LISTCAT.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Fri Aug 19, 2011 9:59 pm
Reply with quote

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
View user's profile Send private message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Fri Aug 19, 2011 10:17 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Aug 19, 2011 10:27 pm
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 19, 2011 10:39 pm
Reply with quote

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
View user's profile Send private message
maheshk84

New User


Joined: 04 Jan 2006
Posts: 22
Location: Chennai

PostPosted: Sat Aug 20, 2011 12:18 am
Reply with quote

Thanks for the suggestion dbzTHEdinosauer. I will modify my code accordingly.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Using the Jobname parameter in a Qual... ABENDS & Debugging 1
No new posts Demand with DEADLINE TIME parameter CA Products 4
No new posts Option DYNALLOC second parameter. DFSORT/ICETOOL 11
No new posts z/vm installation problem All Other Mainframe Topics 0
Search our Forums:

Back to Top