Home » excel » xml – Have to get all the AS400 DB2 field names onto a Table

xml – Have to get all the AS400 DB2 field names onto a Table

Posted by: admin May 14, 2020 Leave a comment

Questions:

I need to create a table that will contain the field names and legnth, of an AS/400 file, and I have to add additional columns for Description, and values. For instance, an Orderheader file would have a field called “STATUS” and its values could be OPEN, CLosed, Held, etc.

SO first I need to get output of these field names and lens, if possible into an .CSV file.

THe purpose is for the users to enter Or I.T. to enter the descriptions etc. then
Reporting tool like SSRS can present these fields to a user as afront end and the user can create the report, i.e. they can see name, address, phone, or just name.

I am thinking just keeping this in Excel might work but I can also create a web page with grids if needed. Or maybe better to output to XML.

How to&Answers:

Use the standard SQL catalogue table called SYSCOLUMNS.
For example,

SELECT TABLE_NAME, COLUMN_NAME, LENGTH, COLUMN_TEXT
FROM SYSCOLUMNS
WHERE TABLE_NAME = 'some_table'