Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

VSAM record count

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
rdasari123

New User


Joined: 28 Aug 2008
Posts: 8
Location: Wilson, NC

PostPosted: Thu Aug 28, 2008 8:19 pm    Post subject: VSAM record count
Reply with quote

Hi,

In a COBOL program, How to retrieve number of records in VSAM file (count) with out reading the file? OR How to retrieve the amount of space allocated to a VSAM file?

If there is no such facility in COBOL program, is there any utility which we can use in JCL and write that information to a dataset?
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Aug 28, 2008 8:26 pm    Post subject:
Reply with quote

IDCAMS LISTCAT will give you this -- write the output to a file instead of SYSOUT and then process it in your COBOL program. As far as I'm aware there's no other way in COBOL to access this type of data (especially without reading the file).
Back to top
View user's profile Send private message
rdasari123

New User


Joined: 28 Aug 2008
Posts: 8
Location: Wilson, NC

PostPosted: Thu Aug 28, 2008 8:34 pm    Post subject:
Reply with quote

I did that.

I used IDCAMS LISTCAT. I do not find any option for record count. Can you tell the options I have to use exactly?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Aug 28, 2008 8:57 pm    Post subject: Re: VSAM Record Count
Reply with quote

This can be accomplished via an Assembler program, which issues a SHOWCB Macro, FIELDS=NLOGR.

SHOWCB Example -

Code:

         LA    R10,PGMWORKA        POINT TO ALIGNED-WORKAREA (REQUIRED)   
         SHOWCB AM=VSAM,ACB=(R11),AREA=(R10),LENGTH=PRMVSAML,          X 
               FIELDS=(NLOGR)                                     
         ST    R15,RETNCODE        STORE IN FWORD                         
         MVC   PRMRECDS,0(R10)     POPULATE NBR-OF-RECORDS FWORD 
         CNOP  0,4                 ENSURE FWORD ALIGNMENT                 
PGMWORKA DS    XL256               PGM-WORKAREA               

Regards,

Bill
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Aug 28, 2008 8:57 pm    Post subject:
Reply with quote

LISTCAT ENT(???) ALL is the precise command to use.

Part of the output for a VSAM file will be the STATISTICS section:
Code:
      STATISTICS
        REC-TOTAL----------10095     SPLITS-CI-------------20
        REC-DELETED------------0     SPLITS-CA--------------0
        REC-INSERTED---------250     FREESPACE-%CI---------10
        REC-UPDATED----------118     FREESPACE-%CA---------10
        REC-RETRIEVED-----483143     FREESPC----------2727936
      ALLOCATION
        SPACE-TYPE------CYLINDER     HI-A-RBA---------7372800
        SPACE-PRI-------------10     HI-U-RBA---------5160960
        SPACE-SEC--------------5

REC-TOTAL is the record count. HI-A-RBA is the high allocated RBA, which tells you how many bytes are allocated; HI-U-RBA tells you the highest used RBA (which is NOT how many bytes are used in the file since free space can be in the used CI areas).
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Thu Aug 28, 2008 9:37 pm    Post subject:
Reply with quote

Are not statistics for vsam only 'truely' accurate after a reorg?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Thu Aug 28, 2008 10:48 pm    Post subject:
Reply with quote

It depends -- APAR OA06499 has this to say
Quote:
VSAM does not update data set statistics if the data set is not
closed properly. Thus, signifcant changes that should have been
reflected in the statistics for the data set will not appear.
That has led to significant confusion by customers, as they know
changes were made but they are not reflected in the statistics.
The content of the statistics information will be incorrect
until the data set is rebuilt; there is no way to correct them.
which implies that if the data set is closed properly the statistics will be updated. If the VAM file is open to CICS or a batch program when you're looking at the statistics, they may not be accurate.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Aug 29, 2008 11:45 am    Post subject:
Reply with quote

That's why it is advisable to run an IDCAMS VERIFY before the listcat, which does an open and close of the file.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts VSAM Space Allocation mrgnndhmk JCL & VSAM 7 Sat Apr 22, 2017 12:42 am
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us