Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a PC program that is used just by other programmers in my company as a friendly backend to a System i database. (IBM used to call it an AS400 or an iSeries and now they call it System i.) The program allows users to enter a library and file name and it will display various information about the file (column names, data types, sizes, etc.) and users can also see the data in the files and add/edit/delete. The problem I'm having right now is that some files are setup with a DDS that specifies valid values for a column. For example, the DDS of a file with a field that only allows a Y or an N string value would look like this:

MYFIELD1   1A   COLHDG('A Yes or No column')
                TEXT('A Yes or No' 'column')
                VALUES('Y' 'N')


I want to add code in my PC program that will check if a field has specified values, and if it does then make sure those rules are adhered to. However, I have no idea where the values are being stored in the System i's system files.

I currently get most field information (the field names, data types, etc) by using the .GetSchemaTable from an iDB2DataReader:
VB
Dim cmdSchema As New IBM.Data.DB2.iSeries.iDB2Command
Dim rdrSchema As IBM.Data.DB2.iSeries.iDB2DataReader = Nothing
cmdSchema.CommandText = "SELECT * FROM " & strLibraryFile
cmdSchema.Connection = gblDb400
rdrSchema = cmdSchema.ExecuteReader(CommandBehavior.KeyInfo)
dtSchema = rdrSchema.GetSchemaTable

And then grab other information like key ordinals from QSYS.QADBKFLD and file description information from QSYS.QADBXREF. But am having trouble finding these specified values anywhere. Does anyone know the system file I am looking for?
Posted
Updated 15-Sep-11 10:05am
v2
Comments
Mehdi Gholam 15-Sep-11 17:09pm    
Are the rules enforced by the server?
Kschuler 15-Sep-11 17:21pm    
Yes. When working on the "green screen" AS400 and trying to perform updates the rules require the field to be Y or N. I just want to copy that functionality in my PC program. - In otherwords, my PC program would still allow me to put a T in that field, for example.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900