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

Check if generation exists using LISTCAT


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ram5er

New User


Joined: 14 Jul 2006
Posts: 14
Location: Dallas, Texas

PostPosted: Thu Oct 30, 2008 4:08 am
Reply with quote

I have a problem and hoping someone can help.

In my JCL the first step is to check for an existing GDG (+1) using LISTCAT level.
Code:
//STEP1 EXEC PGM=IKJEFT01,                               
//  PARM='LISTC LVL(''HLQ.DATASET.NAME'')'
//SYSTSPRT DD  SYSOUT=*                                 
//SYSTSIN  DD  DUMMY                                     
//SYSUDUMP DD  SYSOUT=Y

Expected result is RC=0 (non-vsam dataset exist) or RC=4 (non-vsam dataset doesn't exist. This working fine until there is a another GDG base with same naming convention except it has another node at the end and return code is coming back with a 0. (ex. HLQ.DATASET.NAME.TMP)

Question... is there a way to just check for HLQ.DATASET.NAME.G* using LISTCAT or does someone have a better to see if a generation dataset exists.

Edited: Please use BBcode when You post some code, that's rather readable...Anuj
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Oct 30, 2008 5:50 am
Reply with quote

Hello,

Quote:
is there a way to just check for HLQ.DATASET.NAME.G*
This would not work for all datasets - datasets other than GDGs may have a G as the first character of a dsname node. . .

What are you really trying to accomplish? What happens when you get one or the other rc?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Oct 30, 2008 6:12 am
Reply with quote

Hi,

Quote:
In my JCL the first step is to check for an existing GDG (+1) using LISTCAT level.


A +1 GDG has to be created first in the job before it can be tested.


Gerry
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Thu Oct 30, 2008 9:05 am
Reply with quote

Hi,

I agree with Gerry, first I thought that only then I thought it may be a question about a Data Set triggered JOB- but if so then this should be a quirk of scheduling software rather then of an Application engg. if so then why to use LISTCAT..

Since morning I'm thinking what type of design is this - mercy ..OP please reveal what's your final destination ?

-Ad
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Oct 30, 2008 9:09 am
Reply with quote

Hello,

I believe the +1 was a "typo".

I suspect that this is to check existence of a dataset to prevent the "data set not found" error. . .
Back to top
View user's profile Send private message
ram5er

New User


Joined: 14 Jul 2006
Posts: 14
Location: Dallas, Texas

PostPosted: Thu Oct 30, 2008 9:35 am
Reply with quote

Sorry for not being clear enough...

Here's the scenerio...

I have a scheduled job to process the whole gdg family one at a time. First step verifies whether or not there is a current generation that exist. If exist, I'm expecting a RC=0 which then the next step does a Connect:Direct transfer.

After the transfer is completed the current gen is backed up. In the last step the job is re-submitted through the internal reader to pick up the next generation. Keeps re-submitting until the whole gdg family is processed. Once all files have been processed a RC=4 indicates no more files and bypass the rest of the step.

Problem... When doing the LISTCAT above it's picking up the gdg base and giving a RC = 4.

Any help is appreciated...
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6248
Location: Mumbai, India

PostPosted: Thu Oct 30, 2008 10:49 am
Reply with quote

Hi,
Quote:
[quote="ram5er"]First step verifies whether or not there is a current generation that exist.
Can only latest GDG exist ? or Can there be muliple GDGs ?

Quote:
After the transfer is completed the current gen is backed up.
Is "that GDG" deleted after a successful send ?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Thu Oct 30, 2008 12:27 pm
Reply with quote

If multiple generations exist what is in place to stop the same generations as yesterday being NDM'd ?

By family I can only assume that you mean all generations.

When the current generation is backed up, is it also deleted.

You really do need to learn to give a lot more useful information for us to understand the problem and offer viable solutions.
Back to top
View user's profile Send private message
ram5er

New User


Joined: 14 Jul 2006
Posts: 14
Location: Dallas, Texas

PostPosted: Thu Oct 30, 2008 8:46 pm
Reply with quote

Yes, There can be mulitple gens. Since each gen has header & trailers we can only send each gen seperatly. So the job is re-submitted until all gens have been picked up, sent and deleted.

Code:

//*--------------------------------------------------------------------
//*PS050- VERIFY THAT THE INPUT FILE EXISTS                           
//*--------------------------------------------------------------------
//PS050    EXEC PGM=IKJEFT01,                                         
//             PARM='LISTC LVL(''&DSNI'')'                             
//SYSTSPRT DD  SYSOUT=&JCL                                             
//SYSTSIN  DD  DUMMY                                                   
//SYSPRINT DD  SYSOUT=&JCL                                             
//SYSUDUMP DD  SYSOUT=Y                                               
//*                                                                 
//*-----------------------------------------------------------------
//*PS040- COPY THE INPUT TRANSMISSION FILE TO A ZY2XX FILE         
//*-----------------------------------------------------------------
//PS040    EXEC PGM=SYNCSORT,                                       
//             COND=(0,LT,PS050)                                   
//*                                                                 
//SORTIN   DD  DSN=&DSNI.(0)                                       
//             DISP=(OLD,DELETE,KEEP)                               
//*                                                                 
//SORTOUT  DD  DSN=&DSNO.(+1),                                     
//             DISP=(NEW,CATLG,DELETE),                             
//             DCB=(SYS1.MODEL,BLKSIZE=0),                         
//             UNIT=CARE,                                           
//             VOL=(,RETAIN,,10)                                   
//*                                                                 
//SORTOFDS DD  DSN=&DSNO..RPT,                                     
//             DISP=(NEW,CATLG,DELETE),                             
//             DCB=(SYS1.MODEL,RECFM=FBA,LRECL=35,BLKSIZE=0),       
//             UNIT=SYSDA, 
//             SPACE=(TRK,(1,2),RLSE)                           
//*                                                             
//SYSUDUMP DD  SYSOUT=Y                                         
//SORTMSG  DD  SYSOUT=&JCL                                       
//*                                                             
//SYSIN    DD  DSN=ISSL.PROD.CONTROL(&SRTCNTL),                 
//             DISP=SHR                                         
//*                                                             
//*-----------------------------------------------------------------
//*PS030- CREATE AN XPTR NOTIFY REPORT                             
//*-----------------------------------------------------------------
//PS030    EXEC PGM=ZY0000I0,                                       
//             COND=(0,LT,PS050)                                   
//*                                                                 
//STEPLIB  DD  DSN=DBAP.ADABAS.&DBAS..LOADLIB,                     
//             DISP=SHR                                             
//         DD  DSN=ISSL.&ENV1..LOADLIB,                             
//             DISP=SHR                                             
//         DD  DSN=ISSL.&ENV2..LOADLIB,                             
//             DISP=SHR                                             
//         DD  DSN=ISSL.EFXP.LOADLIB,                               
//             DISP=SHR   
//         DD  DSN=ISSL.PROD.LOADLIB,                               
//             DISP=SHR                                             
//SYSUDUMP DD  SYSOUT=Y                                             
//SYSOUT   DD  SYSOUT=&JCL                                         
//SYSPRINT DD  SYSOUT=&JCL                                         
//TSTDMP   DD  SYSOUT=&JCL                                         
//DDCARD   DD  DSN=PADFA.ISDPR.&DBAS.DBID.UPDT,                     
//             DISP=SHR                                             
//*                                                                 
//SRTIN    DD  DSN=&DSNO..RPT,                                     
//             DISP=(OLD,DELETE,KEEP)                               
//*                                                                 
//CNTLIN   DD  DSN=ISSL.PROD.CONTROL(&TITLE),                       
//             DISP=SHR                                             
//*                                                                 
//XPTRRPT  DD  SYSOUT=&XPTR                                         
//*   
//*-----------------------------------------------------------------
//*  PS020 - BUILD AND SUBMIT THE NDM JOB                           
//*-----------------------------------------------------------------
//PS020    EXEC PGM=&TRANSPGM,                                     
//             PARM='&NEXTJOB',                                     
//             COND=((0,LT,PS060),&PS030CND)                       
//*                                                                 
//STEPLIB  DD  DSN=ISSL.&ENV1..LOADLIB,                             
//             DISP=SHR                                             
//         DD  DSN=ISSL.&ENV2..LOADLIB,                             
//             DISP=SHR                                             
//         DD  DSN=ISSL.EFXP.LOADLIB,                               
//             DISP=SHR                                             
//         DD  DSN=ISSL.PROD.LOADLIB,                               
//             DISP=SHR                                             
//*                                                                 
//DDCARD   DD  DSN=PADFA.ISDPR.&DBAS.DBID.UPDT,                     
//             DISP=SHR                                             
//SYSOUT   DD  SYSOUT=&JCL                                         
//DDPRINT  DD  SYSOUT=&JCL
//NDMFILE  DD  DSN=&DSNO1(+1),                         
//             DISP=SHR                               
//CNTL     DD  DSN=ISSL.&CNTLENV1..CONTROL(&TRANINFO),
//             DISP=SHR                               
//SUBJCL   DD  SYSOUT=&INTRDR                         
//*
//*-----------------------------------------------------------------   
//*PS010- SUBMIT THIS JOB AGAIN                                       
//*-----------------------------------------------------------------   
//PS010     EXEC PGM=IUJSUBI3,                 
//             PARM=&THISJOB&P,               
//             COND=(00,NE)                 
//STEPLIB  DD  DSN=ISSL.&ENV1..LOADLIB,       
//             DISP=SHR                       
//         DD  DSN=ISSL.&ENV2..LOADLIB,       
//             DISP=SHR                       
//         DD  DSN=ISSL.EFXP.LOADLIB,         
//             DISP=SHR                       
//         DD  DSN=ISSL.PROD.LOADLIB,         
//             DISP=SHR                       
//SYSUDUMP DD  SYSOUT=Y                       
//SYSOUT   DD  SYSOUT=&JCL                   
//SYSPRINT DD  SYSOUT=&JCL                   
//PARMJCL  DD  DSN=&P.ASFA.TADPR.IUJSUB.PARM,
//             DISP=SHR                       
//IUISJCL  DD  SYSOUT=(B,INTRDR),             
//             DCB=BLKSIZE=80                 
//JCLLIB   DD  DSN=ISSL.&ENV1..JCL,           
//             DISP=SHR                       
//             DISP=SHR           
//         DD  DSN=ISSL.&ENV2..JCL,
//             DISP=SHR           
//         DD  DSN=ISSL.EFXP.JCL, 
//             DISP=SHR           
//         DD  DSN=ISSL.PROD.JCL, 
//             DISP=SHR           
//*   
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Oct 31, 2008 2:26 pm
Reply with quote

Looks to me that you will need to write a quick REXX that will parse and check the LISTCAT output.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Fri Oct 31, 2008 3:07 pm
Reply with quote

And as I am in such a good mood today and already have some very similar code

JCL
Code:

//STEP1    EXEC PGM=IKJEFT01,PARM='LISTCATR GDG-base-name' 
//SYSEXEC  DD DSN=Your REXX library,DISP=SHR         
//SYSTSPRT DD SYSOUT=*                     
//SYSTSIN  DD DUMMY                       

REXX MEMBER=LISTCATR stored in Your REXX Library
Code:

/* REXX *** CHECK IF GENERATIONS EXIST FOR GIVEN GDG BASE            */
ARG GDGBASE .                                                         
EXITCC = 4                                                             
X = OUTTRAP(LISTC.)                                                   
"LISTC ENT('"STRIP(GDGBASE)"') NAME"                                   
X = OUTTRAP('OFF')                                                     
DO AA = 1 TO LISTC.0                                                   
  PARSE VAR LISTC.AA W1 .                                             
  IF W1 = "NONVSAM" THEN EXITCC = 0                                   
  IF EXITCC = 0 THEN LEAVE                                             
END                                                                   
EXIT (EXITCC)                                                         
Back to top
View user's profile Send private message
ram5er

New User


Joined: 14 Jul 2006
Posts: 14
Location: Dallas, Texas

PostPosted: Fri Oct 31, 2008 8:02 pm
Reply with quote

It works perfectly... Thanks for your help.

Where do I send the check??? icon_wink.gif
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
No new posts Check if CICS is online in JCL CICS 10
No new posts VSAM LISTCAT INFORMATION JCL & VSAM 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top