I want to write one common batch program,which should run daily..
Which shows the total number of records for n number of physical files.
the total number of records should be stored in one physical file,which should contain date,file name,and total number of records.
Please help me out in writing this program
Thanks
Software/Hardware used:
AS400
ASKED:
September 14, 2010 9:00 AM
UPDATED:
October 31, 2010 5:35 AM
Rudedog’s approach is a good one, especially if you’re interested in only specific files. If you want something that looks at ALL objects use this command (no RPG needed):
QSYS/RTVDSKINF
To learn more about this command see: http://publib.boulder.ibm.com/iseries/v5r2/ic2928/index.htm?info/cl/rtvdskin.htm
“…the collected information will be stored in file QAEZDISK” which you can view using STRSQL command.
If you like, I have a spreadsheet that reads QAEZDISK called “AS400_Disk_Utilization.xls“. It displays any library you choose or all libraries by size and permits drill down into each library to see all objects in the library by size, and if you double click on a PF of LF, it will display the contents of the file in Excel.
Anyone can ask for this spreadsheet. e-Mail me at: CHatmaker@CarlisleCC.com and ask for “AS400_Disk_Utilization.xls“. After you get the spreadsheet, if you want information on how it was coded, see my blog in itknowledgeexchange at: Beyond Excel
Requirements: Excel, Client Access
The question seems not to have a point. There doesn’t seem to be anything useful that you can do with a file that lists the number of records in other files.
And without a little more description of the business problem that you are trying to solve, there doesn’t seem to be any good answer possible.
For example, what do you mean by “n number of physical files”?
Is that supposed to mean the you will tell your batch program a number (n) and it will look at the first (n) files it finds? Or does it mean that you will provide a list of files that may have (n) elements in the list? Is the program supposed to figure out which files by some method? (Do you know the method that you want to use?)
Should the resulting file be added to or replaced every day? Do you just want to know the number of records or do you actually need to know number of additions and deletions? Do you want all records in the files including deleted records? Or do you only want the number of active records? What about files with more than one member? (What if the file doesn’t have a member? What about partitioned files?)
Will these only be physical files? Or might you also be tracking logical files?
A description of the business problem would be much better than asking a general technical question that doesn’t seem to have any point. There are so many possible variations because of the missing technical details as to be effectively impossible.
Tom
While the QAEZDISK and DSPFD are both fairly traditional approaches, herewith something else to consider. (as another email suggested, depends on the big picture.)
If you define a file INPUT in the F-Spec, and you also add UsrOpn and ExtFile, and add the File-feedback-data-structure, .. all you have to do is change the values in the ExtFile to point to the file you want to check, and then open it. The feedback DS will tell you the current record nbr (same as DSPFD).. It is a different approach, but I do it for a list of files and drive it in my RPG program ..
good luck
kmh
The feedback DS will tell you the current record nbr (same as DSPFD).
The Open feedback area will show the “Number of records in the member at open time.” at offset 75.
Tom
Sure, but speaking subject to correction, it does not include deleted records – right ?
Boykie
If you want something that looks at ALL objects use this command …
There are problems with RTVDSKINF and QAEZDISK in this case.
First, it reports sizes — not record counts. If record counts really are wanted, then RTVDSKINF is no help.
Next, the multi-member structure complicates things, especially a new developer. That’s not a big deal by itself; but running RTVDSKINF daily and managing its members can be tricky regardless of experience. The system might not allow for daily runs.
Finally, it’s not indexed. And because it’s multi-member, managing an index also gets tricky.
There are far easier ways if we get a little more clarification of the business problem that needs to be solved.
Tom
If you define a file INPUT in the F-Spec, and you also add UsrOpn and ExtFile, and add the File-feedback-data-structure, .. all you have to do is change the values in the ExtFile to point to the file you want to check, and then open it.
That’s a little more difficult for a set of files that all have different record formats. A beginning programmer will have enough difficulty handling UsrOpn and ExtFile logic. Complicating it with overrides for level checks and/or format mismatches on every file is probably too much.
Further, it’s necessary to build a list of the files before RPG can even know which overrides to apply and what to put in to ExtFile. If a list is built, it might as well be built with member details that already include record counts.
Tom