View previous topic :: View next topic
|
Author |
Message |
rexx77
New User
Joined: 14 Apr 2008 Posts: 78 Location: Mysore
|
|
|
|
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 |
|
|
genesis786
Active User
Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
does your shop have 'whohas' ? u can try using 'TSO WHOHAS'... |
|
Back to top |
|
|
rexx77
New User
Joined: 14 Apr 2008 Posts: 78 Location: Mysore
|
|
|
|
whether WHOHAS works for VSAM files? |
|
Back to top |
|
|
genesis786
Active User
Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
genesis786
Active User
Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
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
|
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
|
genesis786
Active User
Joined: 28 Sep 2005 Posts: 210 Location: St Katherine's Dock London
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Many thanks, much appreciated. |
|
Back to top |
|
|
|