|  This article describes a code download 
                  which demonstrates using VB.Net to connect to an AS/400 and 
                  produce and Excel spreadsheet. If you do not have Visual 
                  Basic, you can download the Express Edition for
                  FREE from 
                  Microsoft and use it to talk to your iSeries and automate 
                  Excel!  The file available here 
                  contains an AS/400 stored procedure, a Visual Basic 2005 
                  Express Edition project and a spreadsheet template. Create a 
                  directory called iSeriesTestSpreadsheet on your computer and 
                  extract all of the files in this zip to that directory.  The purpose of the project is to create a 
                  listing of the logical files and SQL indexes available over a 
                  table or physical file on the iSeries. This listing contains 
                  some interesting information like the utilization of the 
                  logical files versus other logical files, the number of days 
                  since the file was accessed, and the selectivity of the keys 
                  in the logical. I find it extremely useful in evaluating the 
                  effectiveness of an index or logical file.  The program works by showing a windows form 
                  which prompts for User ID, Password, 400 Name, Library and 
                  physical file name. Once this information is provided, and the 
                  user clicks the GO button, the program creates a connection to 
                  the iSeries, queries the system catalogue to find all of the 
                  logical files associated with the physical file and for each 
                  file runs the DSPFD command and redirects the output to a file 
                  in QTEMP. Once this is complete, the program issues two SQL 
                  statements to populate a DataSet object, starts Microsoft 
                  Excel, opens a template and then processes the dataset to 
                  create the spreadsheet.  Click here to see an 
                  example of the spreadsheet output.  Making it work  To use this code, first use SQLThing 
                  Enterprise Edition, or Client Access Run SQL Scripts if you 
                  must, to create the stored procedure LFINFO. Note that this 
                  procedure is contained in the LFINFO Procedure.SQLP 
                  file in the download. Note that this procedure takes the 
                  library, filename and output filename and takes care of 
                  processing the DSPFD information for both the physical file 
                  and all of it's associated logical files and SQL indexes. The 
                  procedure excludes any multi-format logical files as they can 
                  not be used in SQL processing.  Procedure Code       
 |