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

Finding the allocation of VSAM file


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

New User


Joined: 14 Apr 2008
Posts: 78
Location: Mysore

PostPosted: Mon Sep 15, 2008 11:50 am
Reply with quote

Hi all,

I am planning to develop a small tool which will be used to find out the the Datasets which are coded in the JCL with DISP not equal to NEW is being used by current user or some other user?

This tool wil display a error message under the datset name if the corresponding dataset is used by the current user or some other user.

For sequential file and for GDG versions i can get the allocation status using ALLOC command or using LISTA ST function. But for VSAM files i dont have any idea of how to find out the allocation status?

If anyone has any idea please let me know.

Thanks
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Mon Sep 15, 2008 2:42 pm
Reply with quote

does your shop have 'whohas' ? u can try using 'TSO WHOHAS'...
Back to top
View user's profile Send private message
rexx77

New User


Joined: 14 Apr 2008
Posts: 78
Location: Mysore

PostPosted: Thu Sep 18, 2008 3:17 pm
Reply with quote

whether WHOHAS works for VSAM files?
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Thu Sep 18, 2008 3:31 pm
Reply with quote

works for me...

tso whohas 'TSO1.ORDER.IN.FLIGHT.KSDS'

Code:

*** Number of jobs using resource TSO1.ORDER.IN.FLIGHT.KSDS is 1 ***
Jobname    Type                                                             
-------    ----                                                             
CICSFR    SHRD                                                             
-------    ----                                                             
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Thu Sep 18, 2008 3:33 pm
Reply with quote

genesis786 wrote:
works for me...

tso whohas 'TSO1.ORDER.IN.FLIGHT.KSDS'

Code:

*** Number of jobs using resource TSO1.ORDER.IN.FLIGHT.KSDS is 1 ***
Jobname    Type                                                             
-------    ----                                                             
CICSFR    SHRD                                                             
-------    ----                                                             


Can you post the code of your version. The one that I cribbed from my last shop doesn't work here icon_cry.gif
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Thu Sep 18, 2008 5:53 pm
Reply with quote

i tried this.. if lm.0 is more than 1 then the cluster is basically shared by some other job. if u want to know what job, then u can do further operations with lm. stem...

Code:

dsn="'TSO1.ORDER.IN.FLIGHT.KSDS'"
x = outtrap('lm.')                         
address tso "whohas" dsn                   
x = outtrap('off')                         
say lm.0                                   


icon_smile.gif
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Fri Sep 19, 2008 8:26 am
Reply with quote

I think he wanted the source of the 'whohas' itself, not the source of
the caller of whohas.

You can also use the QUERYENQ service of ISPF to get enqueue information.
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri Sep 19, 2008 11:27 am
Reply with quote

Thanks Pedro, it seems that my version called a program DSNCA which isn't here at my new site.

Thanks for the pointer on QUERYENQ - Will try and follow that one up if I get some spare.
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Sep 19, 2008 1:23 pm
Reply with quote

hi expat.. here is the whohas source:

Code:

/* REXX ==============================================================*/00010000
/*                                                                    */00020000
/* This sample REXX procedure will display jobs which have issued     */00030000
/* an enqueue for a specific resource like a data set name.           */00040000
/*                                                                    */00050000
/* Input parameter: res - The resource name to test                   */00060000
/*                                                                    */00070000
/*====================================================================*/00080000
                                                                        00090000
/*--------------------------------------------------------------------*/00100000
/* Change to TRACE I for testing from TRACE N                         */00110000
/*--------------------------------------------------------------------*/00120000
TRACE N                                                                 00130000
                                                                        00140000
/*--------------------------------------------------------------------*/00150000
/* Check for required parameter                                       */00160000
/*--------------------------------------------------------------------*/00170000
PARSE UPPER ARG res                                                     00180000
res = strip(res)                                                        00181000
res = strip(res,,"'")                                                   00182000
"TSOCLEAR"                                                              00183000
IF res = '' THEN                                                        00184000
  DO                                                                    00185000
    SAY 'Required resource parameter missing'                           00186000
    EXIT(-1)                                                            00187000
  END                                                                   00188000
                                                                        00189000
/*--------------------------------------------------------------------*/00190000
/* Initialization                                                     */00200000
/*--------------------------------------------------------------------*/00210000
accum = 0                                                               00220000
msg. = ''                                                               00230000
ADDRESS 'LINK' 'GSVXRXAA'              /* Init SYSVIEWE address env   */00240000
                                                                        00250000
/*--------------------------------------------------------------------*/00260000
/* Get enqueues for specified resource                                */00270000
/*--------------------------------------------------------------------*/00280000
ADDRESS 'SYSVIEWE' "C(ENQUEUE "res")"                                   00290000
                                                                        00300000
IF QUEUED() = 0 THEN                   /* Error occurred if no data   */00310000
  DO                                                                    00320000
    SAY 'Error - No data returned from ADDRESS SYSVIEWE'                00330000
    SIGNAL EXIT                                                         00340000
  END                                                                   00350000
                                                                        00360000
/*--------------------------------------------------------------------*/00370000
/* Extract 1st line.  Should be a 'M' (Msg line).  Msgid follows...   */00380000
/*--------------------------------------------------------------------*/00390000
PARSE PULL msgline                                                      00400000
                                                                        00410000

/*--------------------------------------------------------------------*/00420000
/* Find header line                                                   */00430000
/*--------------------------------------------------------------------*/00440000
ltype = ' '                                                             00450000
DO WHILE QUEUED() > 0                                                   00460000
  PARSE UPPER PULL ltype 2 ldelim 3 ldata                               00470000
  IF ltype = 'H' THEN LEAVE                                             00480000
END                                                                     00490000
                                                                        00500000
IF ltype ¬= 'H' THEN                   /* Error occurred if no header */00510000
  DO                                                                    00520000
    SAY 'Error - Header line not returned from ADDRESS SYSVIEWE'        00530000
    SIGNAL EXIT                                                         00540000
  END                                                                   00550000
                                                                        00560000
/*--------------------------------------------------------------------*/00570000
/* Get the offsets of required fields                                 */00580000
/*--------------------------------------------------------------------*/00590000
rnameo   = POS('RNAME',ldata)          /* Get offset of Rname field   */00600000
jobnameo = POS('JOBNAME',ldata)        /* Get offset of Jobname field */00610000
typeo    = POS('TYPE',ldata)           /* Get offset of Type field    */00620000
                                                                        00630000
/*--------------------------------------------------------------------*/00640000
/* Process rest of returned data looking for data lines               */00650000
/*--------------------------------------------------------------------*/00660000
DO WHILE QUEUED() > 0                                                   00670000
  PARSE PULL ltype 2 ldelim 3 ldata                                     00680000
  IF ltype = 'D' THEN                  /* Process if data line        */00690000
    DO                                                                  00700000
      PARSE VAR ldata =(rnameo) rname =(jobnameo) jobname =(typeo) type 00710000
      PARSE VAR rname rname (ldelim)   /* Parse rname to delimiter    */00720000
      IF rname = res THEN              /* Process if rname matches    */00730000
        DO                                                              00740000
          PARSE VAR jobname jobname (ldelim) /* Parse jobname field   */00750000
          PARSE VAR type    type    (ldelim) /* Parse type field      */00760000
          accum = accum + 1                  /* Increment accumulator */00770000
          msg.accum = jobname'   'type       /* Save jobname and type */00780000
        END                                                             00790000
    END                                                                 00800000
END                                                                     00810000
                                                                        00820000
/*--------------------------------------------------------------------*/00830000
/* If any jobs found, display them                                    */00840000
/*--------------------------------------------------------------------*/00850000
IF accum > 0 THEN                                                       00860000
  DO                                                                    00870000
    SAY '*** Number of jobs using resource 'res' is 'accum' ***'        00880000
    SAY 'Jobname    Type'             /* Display header              */ 00890000
    SAY '-------    ----'                                               00900000
    DO i = 1 TO accum                  /* Display each job            */00910000
       SAY msg.i                                                        00920000
    END                                                                 00930000
    SAY '-------    ----'             /* Display end line            */ 00940000
  END                                                                   00950000
ELSE SAY '*** Resource 'res' not in use ***'                            00960000
                                                                        00970000
/*--------------------------------------------------------------------*/00980000
/* Exit procedure                                                     */00990000
/*--------------------------------------------------------------------*/01000000
EXIT:                                                                   01010000
/*--------------------------------------------------------------------*/01020000
/* Formal termination of the API is required.                         */01030000
/* Abends will occur if this step is omitted.                         */01040000
/*--------------------------------------------------------------------*/01050000
ADDRESS 'SYSVIEWE' "C(END)"            /* Terminate SYSVIEWE session  */01060000
                                                                        01070000
/*--------------------------------------------------------------------*/01080000
/* Discard any residual output, so TSO won't try to execute it.       */01090000
/*--------------------------------------------------------------------*/01100000
CALL CLEAREDQ                          /* Discard any residual output */01110000
EXIT 0                                                                  01120000
                                                                        01130000
/*====================================================================*/01140000
/* CLEAREDQ Subroutine: Clean out the external data queue             */01150000
/*====================================================================*/01160000
CLEAREDQ: PROCEDURE                                                     01170000
TRACE N                                                                 01180000
  DO WHILE QUEUED() > 0                                                 01190000
  PULL line                                                             01200000
  END                                                                   01210000
RETURN                                                                  01220000
Back to top
View user's profile Send private message
expat

Global Moderator


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

PostPosted: Fri Sep 19, 2008 1:27 pm
Reply with quote

Many thanks, much appreciated.
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 Finding and researching jobs All Other Mainframe Topics 0
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 6
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top