Add field description to DB2 / 400 file

I have a set of files in a library in AS / 400 / iSeries / System-I / whatever-IBM-wants-i-to-call-it-in-days, I don't have DDS for in SQL I'm going to), but to which I would like to add field descriptions. I cannot find a way to do this at 400.

Does anyone know how I can add a field description? Is directly SYSIBM.SQLCOLUMNS update to install COLUMN_TEXT in safe mode?

(I’m not looking for general SQL answers here, but only specific DB2 / 400 answers. Unfortunately, given the renaming of IBM to this platform and the non-google name they chose, it’s almost impossible to find the answers (or especially prove that there isn’t answer) to such questions, without wasting a century, looking through voluminous, impenetrable documentation there)

+7
sql db2 ibm-midrange db2-400
source share
2 answers

Use the LABEL SQL command. If you are using the STRSQL green screen command, you can query it. The LABEL command can be used to set column and column headers.

The following is an example of using the LABEL command to retrieve the column text for two fields in a file named TESTFILE1. The fields are named FIELD1 and FIELD2 in this example:

LABEL ON COLUMN TESTFILE1 (FIELD1 TEXT IS 'My Field 1 text', FIELD2 TEXT IS 'My Field 2 text') 

The following is an example of using the LABEL command to get the column headers that will appear in the query results:

 LABEL ON COLUMN TESTFILE1 (FIELD1 IS 'My field Heading 1', FIELD2 IS 'My field Heading 2') 

When creating column headings, you get 60 characters in the field. The first 20 characters are line 1. The second 20 characters are line 2. The third 20 characters are line 3. In the above example, the field headers look like this:

  My field my field
 Heading 1 Heading 2 
+13
source share

As an additional hint, you can use iSeries Navigator to get the SQL statement for this file. If you run this program, log in to iSeries, go to the database, go to the diagrams and go to the tables, after which you can find your file. You will find the "generate SQL" button somewhere. This creates the exact SQL statement to create the table. You can use this SQL statement to work with this table.

For your questions, "LABEL" from another answer is enough. This answer is useful if you want to do more things that cannot be done with ALTER.

+4
source share

All Articles