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
 

 

Whats the best way to count number of records in VSAM file?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
gnaveenkumar.99

New User


Joined: 21 Sep 2011
Posts: 8
Location: India

PostPosted: Wed Jan 23, 2013 8:33 pm    Post subject: Whats the best way to count number of records in VSAM file?
Reply with quote

Whats the best way to count the number of records in a VSAM File?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jan 23, 2013 8:36 pm    Post subject: Reply to: Whats the best way to count number of records in V
Reply with quote

Whilst reading the data for another purpose.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Jan 23, 2013 9:13 pm    Post subject:
Reply with quote

Hello,

If you are not working with some other process, you could copy the file using your sort product and specify DD DUMMY for the output. The entire input file would be read.
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: Wed Jan 23, 2013 9:42 pm    Post subject: Reply to: Whats the best way to count number of records in V
Reply with quote

You can obtain the number of records on a VSAM file ahead of time, without having to read the file, using a small in-house Assembler Batch program, which issues a SHOWCB Macro, specifying parameter FIELDS, with keyword NLOGR (a binary fullword).

The target file needs to be closed.

I've only used this for fixed-length VSAM files only.

HTH....
Back to top
View user's profile Send private message
Gary McDowell

Active User


Joined: 15 Oct 2012
Posts: 139
Location: USA

PostPosted: Wed Jan 23, 2013 9:45 pm    Post subject:
Reply with quote

Our shop has a REXX command in 3.4 to give a Listcat but the following JCL works well too...
Code:
//*-- PURPOSE: LISTCAT OF VSAM FILE                             
//*-- NOTES:   GET FILE RECORD COUNT FROM DD-SYSPRINT; REC-TOTAL
//*-------------------------------------------------------------
//*                                                             
//STEP005  EXEC PGM=IDCAMS                                     
//SYSPRINT DD SYSOUT=*                                         
//SYSOUD   DD SYSOUT=*                                         
//SYSOUT   DD SYSOUT=*                                         
//SYSIN    DD *                                                 
   LISTCAT ENTRIES (XXXXXXXX.XXXXXXXX.CLUSTER)   ALL           
/*   
Back to top
View user's profile Send private message
Pete Wilson

Active User


Joined: 31 Dec 2009
Posts: 437
Location: London

PostPosted: Thu Jan 24, 2013 9:26 pm    Post subject:
Reply with quote

If you have it SYCHSORT HISTOGRAM is an option and also gives a break down of different record lengths.

Otherwise a sequential copy of the file with repro or sort to a dummy output DD will give a record count.

You can't rely on the record count in LISTCAT unless the file has been closed normally otherwise these stats are not accurate. If the file is closed running an IDCAMS VERIFY before the LISTCAT will ensure the stats are correct.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Thu Jan 24, 2013 10:05 pm    Post subject: Reply to: Whats the best way to count number of records in V
Reply with quote

ICETOOL COUNT will count records without having to specify a dummy dataset.

However, TS seems to have wondered off...
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: Fri Jan 25, 2013 12:58 am    Post subject: Reply to: Whats the best way to count number of records in V
Reply with quote

I have an Assembler main-program, invoked from JCL, which issues a SHOWCB Macro against a target VSAM ACB (either KSDS or ESDS), writes the number of records and max record length to a SYSPRINT report and also writes a record to an 80-byte sequential OUTFILE, with the following data -

01-08 - Target VSAM ACB/File DD Name (Passed as PARM)
09-09 - Blank
10-13 - File-Type (Returns literal "KSDS" or "ESDS")
14-14 - Blank
15-24 - Number of Records, PIC 9(10), Display Numeric
25-25 - Blank
26-30 - Max Record Length, PIC 9(05), Display Numeric
31-80 - Blanks or Future Use

The OUTFILE data-record can then be used as INPUT to the next step, such as SYSIN.

Send a private message if interested....
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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