Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Keep up the good work - excellent site - i'd been looking for something like this for ages !..."

Geography

Where in the world do Tek-Tips members come from?

How to capture the total number of records into a temp variable.

sureshallampati (TechnicalUser)
9 Mar 07 3:48
Hi,

During project i need to i need to check two files whether they have same number of records or not.
for ex let us take two files ave0439.database.file1 and ave0439.database.file2.
And with below two queries i am getting the number of records in printing. but i need to store that in some variable. IS there any process that i can get directly the number of records or number of segments of a focus database file.

The queries are :
=================
Dynam free dd batabase
Dynam alloc dd database da ave0439.database.file1 shr reu
table file database
print b_date
end

Dynam free dd batabase
Dynam alloc dd database da ave0439.database.file2 shr reu
table file database
print b_date
end
Could you please anyone help me in this regard.

thanks.



jimster06 (Programmer)
10 Mar 07 12:09
There are a couple of system variables available to you:
&RECORDS which is the number of records retreived in the last answer set and
&LINES which is the number of lines printed in the last answer set.
I don't know if you can directly determine the number of records in a FOCUS database but try the following:
TABLE FILE DATABASE
PRINT B_DATE NOPRINT
END
-TYPE &RECORDS
Alternatively
TABLE FILE DATABASE
COUNT B_DATE
END
You must be aware of what you are counting, ie the root segment or a dependent segment; set your code appropriately.
sureshallampati (TechnicalUser)
12 Mar 07 7:52
Hi jimster06,

Yes i got the record count. Thanks very much for your help here.
However it would be greate if you provide me some more help regarding this,i.e here getting the number of pages , and it is waiting for the responce. So it is not feasable to do it in batch validations. I.e. It would be better if i can get the direct &RECORDS value by without printing all the data.

So could you please let me know whether is there any way for that case...


Thanks & Regards,
SureshAllapmati


jimster06 (Programmer)
12 Mar 07 15:20
The alternative I cited will generate a very short report.
TABLE FILE DATABASE
COUNT B_DATE
END
will read the database and, at the end, display a count of the number of instances of B_DATE.
The first example I noted should print NO report.
Why do you need the number of pages?

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close