Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am
No new posts Question related to Data dictionary f... rexx77 SYNCSORT 3 Thu Aug 31, 2017 7:23 am
No new posts Extract Data till prev hour balaji81_k DB2 16 Fri Aug 25, 2017 9:25 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us