How to count he number of records in a dataset

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
kool78
Participant
Posts: 104
Joined: Sat Aug 20, 2005 2:02 pm

How to count he number of records in a dataset

Post by kool78 »

Any ideas on how to get eh count of number of records for a dataset.

i tried to look for the 'orchadmin' commands but didnt find any help.

thanks
"Attitude always and almost determines the altitude of your Life"
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Re: How to count he number of records in a dataset

Post by vijayrc »

kool78 wrote:Any ideas on how to get eh count of number of records for a dataset.

i tried to look for the 'orchadmin' commands but didnt find any help.

thanks
Manager/DataSet Management..... :P
kool78
Participant
Posts: 104
Joined: Sat Aug 20, 2005 2:02 pm

Re: How to count he number of records in a dataset

Post by kool78 »

vijayrc wrote:
kool78 wrote:Any ideas on how to get eh count of number of records for a dataset.

i tried to look for the 'orchadmin' commands but didnt find any help.

thanks
Manager/DataSet Management..... :P

is there any other way...i know we can get the count from dataset manager/managment.

i want to use it in my process..like if records exist then proceed else not.
"Attitude always and almost determines the altitude of your Life"
Teej
Participant
Posts: 677
Joined: Fri Aug 08, 2003 9:26 am
Location: USA

Post by Teej »

I am not too familiar with how "orchadmin" is ported to the Windows platform (most likely using the wrapper). It is located within PXEngine/bin subdirectory within DataStage's directory.

If it was on the UNIX box, it would be a very simple task of using a command stage within a sequencer job to call orchadmin with the relevant options (you can find out the available options running it without any options).

Give it a try, and remember -- you need to be on the DataStage SERVER not your own client.
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Post by ag_ram »

This is the sample code.

Code: Select all

export DSHOME = '/appl/infoserver/Server/DSEngine'
export APT_CONFIG_FILE = '/appl/infoserver/Server/Configurations/2node.apt'
export APT_ORCHHOME = '/appl/infoserver/Server/PXEngine'
export PATH = '%PATH%' : '/appl/infoserver/Server/PXEngine/bin'
export ORCHBIN = APT_ORCHHOME : '/bin'
export LIBPATH = '/appl/infoserver/Server/PXEngine/lib'

[b]dsrecords DSdir/datasetFilename.ds[/b]
You can catch the return code which is the count of records in dataset.
umamahes
Premium Member
Premium Member
Posts: 110
Joined: Tue Jul 04, 2006 9:08 pm

Post by umamahes »

dsrecords <datasetname>

Thanks
HI
kool78
Participant
Posts: 104
Joined: Sat Aug 20, 2005 2:02 pm

Post by kool78 »

umamahes wrote:dsrecords <datasetname>

Thanks
thanks for the response, seems to be working.. it displays the out put as ex: 1500 records

can we omit the later part i,e' records' and allow it to display only the value like 1500.
"Attitude always and almost determines the altitude of your Life"
jhmckeever
Premium Member
Premium Member
Posts: 301
Joined: Thu Jul 14, 2005 10:27 am
Location: Melbourne, Australia
Contact:

Post by jhmckeever »

Hi kool78,

Off the top of my head, I think the following should work ...

Code: Select all

for /f "tokens=1" %a in ('dsrecords YOURFILE') do echo %a
... where YOURFILE is your dataset descriptor file.

HTH,
John.
<b>John McKeever</b>
Data Migrators
<b><a href="https://www.mettleci.com">MettleCI</a> - DevOps for DataStage</b>
<a href="http://www.datamigrators.com/"><img src="https://www.datamigrators.com/assets/im ... l.png"></a>
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

kool78 wrote:can we omit the later part i,e' records' and allow it to display only the value like 1500.
Use the -n option of the dsrecords command.

Code: Select all

dsrecords -n /app/Ascential/DataStage/Projects/MyProject/Controls/MyDataSet.ds
Best Practice Tip
Create a directory in your project in which all descriptor files for Data Sets, Lookup File Sets and File Sets are kept and make the pathname of that directory a job parameter.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kool78
Participant
Posts: 104
Joined: Sat Aug 20, 2005 2:02 pm

Post by kool78 »

ray.wurlod wrote:
kool78 wrote:can we omit the later part i,e' records' and allow it to display only the value like 1500.
Use the -n option of the dsrecords command.

Code: Select all

dsrecords -n /app/A ...[/quote]

thanks ray,

followed the dsrecords method,


dsrecords -n <datasetname>
"Attitude always and almost determines the altitude of your Life"
Post Reply