My qn was how to read all members one bye one.
It can depend on the version of your OS. Please provide some info on your environment.
CL can read the records from the output file that Phil mentions. You can also use the RTVMBRD command to retrieve member names one at a time. The RTVMBRD command avoids needing to read the DSPFD output file. (You could also use the List Database File Members (QUSLMBR) API to list members in a user space.)
From i 6.1 on, you can do it easier in a single program. If you need to do it in CL earlier than i 6.1, it requires at least two CL programs.
its not possible to open and close the members one by one. suppose if file have 25 members, its inappropriate. There should be some other method which reads each members and checks.