PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Total # of records in a file

View previous topic View next topic Go down

Total # of records in a file

Post  rajkumar400 on Mon Dec 27, 2010 8:46 pm

What is the simplest way to find out total # of records in a file?

Thanks.
Raj

rajkumar400

Posts : 59
Join date : 2010-12-25

View user profile

Back to top Go down

Re: Total # of records in a file

Post  soundhar on Mon Dec 27, 2010 10:09 pm

Using DSPFD u can get number of records in a file

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Re: Total # of records in a file

Post  rajkumar400 on Wed Dec 29, 2010 2:16 am

ThANKS. But inside the RPG.

rajkumar400

Posts : 59
Join date : 2010-12-25

View user profile

Back to top Go down

# of records

Post  soundhar on Wed Dec 29, 2010 11:17 am

In command line,Using DSPFD u can get the total no. of records...
In CL,Using RTVMBRD u can get this by NBRCURRCD(ie number of current records)...
In RPG,Using FILE INORMATION DATA STRUCTURE(ie infds) u can get this...

By calculation also we can find this,inside RPG
step0:In F Spec,declare the file as I/P mode
step1:initialize a variable say "X" to 0
step2:READ a file 31
step3:*IN31 DOWEQ *off
step4:ADD 1 to X
step5:Read a file 31
step6:ENDDO
Now X contains number of records

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Re: Total # of records in a file

Post  rajkumar400 on Wed Dec 29, 2010 11:06 pm

Thanks. I will go with INFDS DUE TO performance.

rajkumar400

Posts : 59
Join date : 2010-12-25

View user profile

Back to top Go down

Re: Total # of records in a file

Post  soundhar on Fri Dec 31, 2010 11:31 am

One thing i forgot to say

IN CL,u have one another way to find the number of records...

Using RUNQRY,with outform(*summary) u can find this...

PGM
RUNQRY QRYFILE((PMS90/EMPMST)) OUTFORM(*SUMMARY)
ENDPGM


soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Re: Total # of records in a file

Post  razuk_r on Fri Dec 31, 2010 7:35 pm

Added to this we can use SQL400 or SQLRPG. select count(*) .....

razuk_r

Posts : 65
Join date : 2009-07-31
Location : Chennai

View user profile

Back to top Go down

Re: Total # of records in a file

Post  soundhar on Sat Jan 01, 2011 10:15 pm

thanks bro

soundhar

Posts : 67
Join date : 2010-07-14
Location : Vridhachalam/chennai

View user profile

Back to top Go down

Re: Total # of records in a file

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum