IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Unloading and counting data from a table


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Fri Jan 09, 2009 3:26 am
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: 496
Location: USA

PostPosted: Tue Jan 13, 2009 2:47 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
Search our Forums:

Back to Top