895 pts.
 DB2/400 basics
How will I find out total number of records in a DB file without causing any I/O operation? 
Also
How will I detect the existence of a record in a DB file without causing any I/O operation? 
I think I can use INFDS and the field *RECORD but not sure how this works.
Thanks,
Nutan


Software/Hardware used:
DB2/400
ASKED: September 22, 2010  11:33 AM
UPDATED: June 15, 2012  12:01 PM

Answer Wiki:
Hi Nutan, For the second part of your question are you looking for the existence of a specific record on a file? If so then you can use SETLL and %EQUAL to check for the existence of the record without doing any input e.g. <pre> SETLL (keyflda : keyfldb : keyfldc) FILEA; IF %Equal(FILEA); .......record exists............ ELSE; .......record does not exist............ ENDIF; </pre>
Last Wiki Answer Submitted:  September 22, 2010  1:52 pm  by  NarkedDiver   20 pts.
All Answer Wiki Contributors:  NarkedDiver   20 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Nutan
Right you are, INFDS contains the count of records when the file is open.
But it’s not in the *RECORD location, that’s the record name, useful in multi-format logical files and/or display files.

You will find it in positions 156-159 it’s a Binary number with 0 deccimals

D MYINFDS DS
D MyCntOfRec 156 159 B 0

And Narked is right on .. Setll and %Equals.

Phil

 44,130 pts.

 

thanks a ton both of you…

 895 pts.

 

Great answer, I was also seeking the same DB file matter. But much important DB for HIPAA Complaint Email

 0 pts.

 
 44,130 pts.