how can we findout how many 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
4friends
Participant
Posts: 71
Joined: Tue May 01, 2007 12:51 pm
Location: Mumbai

how can we findout how many records in a dataset

Post by 4friends »

if i created a dataset and loaded records.

how can i find out how many records are there in a dataset
thanks & regards
kk
siva4joy
Premium Member
Premium Member
Posts: 34
Joined: Fri Apr 14, 2006 6:10 am
Location: London

Post by siva4joy »

if it is on unix you can create a routine to find the count in the dataset.
create the server routine and you can use the routine in the sequence by using routine activity you can find the count in the dataset.
the code is given below.

! Call dsrecords for the required data set
CALL DSExecute ( "UNIX", "dsrecords ":PathDataset, Output, RetCode )

! Log the output
CALL DSLogInfo ( "dsrecords ":PathDataset:": " : Output, "GetDsRowCount" )

If RetCode = 0 Then
! Retreive the first output line
Output = Field ( Output, @FM, 1 )

! Strip out the row count numeric part e.g. XX records, XX is count up to space
CountDSRecs = Field ( Output, " ", 1 )
If CountDSRecs = "" Or Num ( CountDSRecs ) = 0 Then
! Record count not found or is not numeric so return 0
CALL DSLogFatal ( "Record count not found", "CountDSRecs" )
Ans = 0

End Else
! Return the number of rows
Ans = CountDSRecs

End

End Else
! Call to dsrecords failed so return 0
CALL DSLogFatal ( "dsrecords call failed, RetCode = ":RetCode, "CountDSRecs" )
Ans = 0

End
Thanks and Regards,
Sivasankar.z
+44-07807478984
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can use the Data Set Management tool under the Tools menu.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Re: how can we findout how many records in a dataset

Post by dsusr »

Following are thevarious options to count the nmber of records:-

1) As Ray said use the Dataset management tool

2) Use the Orchadmin commands i.e. just go into your PXEngine/bin directory type the following commands:-

orchadmin dump < dataset name with path > | wc -l

or use

orchadmin dsrecords < dataset name with Path >

If you can add the complete PXEngine/bin path in your PATH environment variable the you can run these commands from any location on the server.

----
dsusr
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Please note that dsrecords is an independent command, not an orchadmin sub-command.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsusr
Premium Member
Premium Member
Posts: 104
Joined: Sat Sep 03, 2005 11:30 pm

Post by dsusr »

[quote="ray.wurlod"]Please note that [i]dsrecords [/i]is an independent command, not an [i]orchadmin [/i]sub-command. ...[/quote]

Sorry my mistake, i wrongly put orchadmin in front of it.
Post Reply