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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Updating data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm

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