View previous topic :: View next topic
|
Author |
Message |
beto981
New User
Joined: 06 Oct 2006 Posts: 24
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
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 |
|
|
|