File status through JCL

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
kirand
Member
Posts: 4
Joined: Tue May 26, 2009 6:48 pm

File status through JCL

Post by kirand » Tue May 26, 2009 7:00 pm

Hi,

I want to know whether a file is open or Closed thru JCL.

i.e. i shud give the file name as input thru JCL and after submitting it , i should get the output saying that " File1 is open/closed "

Please suggest a way to do it.. :)

User avatar
Krishna
Site Admin
Posts: 1052
Joined: Fri Jan 27, 2006 7:50 am

JCL to find whether file is opened or closed.

Post by Krishna » Fri May 29, 2009 5:04 pm

using following code you can find whether given file is opened or closed.

Code: Select all

//STEP1 EXEC PGM=IKJEFT1A                                            
//SYSUDUMP DD SYSOUT=*                                                  
//SYSOUT   DD SYSOUT=*                                                  
//SYSTSPRT DD  SYSOUT=*                                                 
//SYSPRINT DD  SYSOUT=*                                                 
//SYSTSIN  DD *                                                         
  WHOHAS 'XXX.YYYY.ZZZZ.DATA'                              
//*                                                                     
Data will be printed in SYSPRINT as below.

Code: Select all

   WHOHAS 'XXX.YYYY.ZZZZ.DATA'                              
*** Not in use ***                         
In addition to above.. step will returns return code of 4.

if you want job to write above information to a dataset.. you output
dataset name for DD name SYSPRINT.

maheshvamsi
Active Member
Posts: 52
Joined: Wed Mar 25, 2009 11:56 pm
Location: Banglore

Post by maheshvamsi » Fri May 29, 2009 5:15 pm

Krisha,

it looks like, WHOHAS is a site specific.

I got

IKJ56500I COMMAND WHOHAS NOT FOUND
Thanks

MaheshVamsi

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat May 30, 2009 11:52 am

Yes "WHOHAS" is a nicely written REXX and is a site specific utility.
Regards,
Anuj

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Sat May 30, 2009 12:00 pm

I want to know whether a file is open or Closed thru JCL.
What kind of reqiurement is that? :?

If a file is open when it is needed by some other JCL, that JOB will go on hold, check the JESMSGLG of JOB you will come to know which file is the culprit.
Regards,
Anuj

kirand
Member
Posts: 4
Joined: Tue May 26, 2009 6:48 pm

Post by kirand » Mon Jun 01, 2009 4:08 pm

@anuj...

When we face crisis calls ..
we just want to have a glance on all the important files whether any important file is closed.... and hence we need a report showing only the closed files..
as simple as that ..

@Krishna, thx for the reply ..

it has worked...wonderful.. thx a lot....

READY
WHOHAS 'K11716.ARU040.SETUP'
*** Not in use ***

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others