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

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

Join the forum, it's quick and easy

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

Get Answers for all your queries on IBM i (AS/400).
PMS Information Systems
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Total # of records in a file

3 posters

Go down

Total # of records in a file  Empty Total # of records in a file

Post  rajkumar400 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

Back to top Go down

Total # of records in a file  Empty Re: Total # of records in a file

Post  soundhar 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

Back to top Go down

Total # of records in a file  Empty Re: Total # of records in a file

Post  rajkumar400 Wed Dec 29, 2010 2:16 am

ThANKS. But inside the RPG.

rajkumar400

Posts : 59
Join date : 2010-12-25

Back to top Go down

Total # of records in a file  Empty # of records

Post  soundhar 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

Back to top Go down

Total # of records in a file  Empty Re: Total # of records in a file

Post  rajkumar400 Wed Dec 29, 2010 11:06 pm

Thanks. I will go with INFDS DUE TO performance.

rajkumar400

Posts : 59
Join date : 2010-12-25

Back to top Go down

Total # of records in a file  Empty Re: Total # of records in a file

Post  soundhar 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

Back to top Go down

Total # of records in a file  Empty Re: Total # of records in a file

Post  razuk_r 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

Back to top Go down

Total # of records in a file  Empty Re: Total # of records in a file

Post  soundhar Sat Jan 01, 2011 10:15 pm

thanks bro

soundhar

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

Back to top Go down

Total # of records in a file  Empty Re: Total # of records in a file

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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