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
 

 

Unloading and counting data from a table

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

New User


Joined: 06 Oct 2006
Posts: 24

PostPosted: Fri Jan 09, 2009 2:23 am    Post subject: Unloading and counting data from a table
Reply with quote

Hi,
I would like to count teh number of records in a table, saving the result in a sequential file. How to do???

I tried this (using hpu):

Code:
//C6T0130  EXEC PGM=INZUTILB,
...
//SYSREC00 DD  DSN=DXX.TESTE.TFMV,
...
//SYSIN    DD  *                               
    UNLOAD TABLESPACE PART %%PART               
    DB2 YES   LOCK NO QUIESCE YES QUIESCECAT NO
     SELECT COUNT(*)                           
     FROM %%PROPI.C1TFMVDV;                     
    OUTDDN SYSREC00                             
    FORMAT DSNTIAUL     


The result was:

File - DXX.TESTE.TFMV
*************** Top of Data ***********
..b.................
*************** Bottom of Data ********

I can only view the number in INSYNC....

But i would like to store the result in a file without the structure of the table.

The result expected result is:

File - DXX.TESTE.TFMV
*************** Top of Data ***********
54000
*************** Bottom of Data ********

I want to do this, to compare the number of records of a table and the number of records of another file.

Then i will use EASYTRIEVE to read theese 2 files.


Can anybody help me?

Tks!
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: Fri Jan 09, 2009 3:26 am    Post subject:
Reply with quote

Hello,

Suggest you consider writing a bit of Easytrieve to both count the records in the "other" file, issue a SELECT COUNT(*) from the table and compare the 2 numbers all in one shot.

If using db2 in Easytrieve is not an option there, you could run the count query in batch and write the output to a dataset for use in the Easytrieve code.
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Tue Jan 13, 2009 2:47 am    Post subject: Re: Unloading and counting data from a table
Reply with quote

beto981 wrote:
I would like to count teh number of records in a table, saving the result in a sequential file. How to do???

If you have access to SyncSort for z/OS, you can use the DB2 Query Support, which is documented in Chapter 11 of the Programmer's Guide.

Here is the SYSIN you can code:
Code:
//SYSIN DD *
  SORT FIELDS=COPY
  OUTFIL TRAILER1=(1:COUNT),NODETAIL,REMOVECC
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 Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts HALDB data refresh/copy from producti... vineetanand2007 IMS DB/DC 0 Mon Jan 02, 2017 11:16 am
No new posts JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


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