Most of us have files on our systems with fields that have Column Headings (COLHDG) and field Text (TEXT) that are poorly worded. We tend to leave them that way because we don't want to take the time to perform all of the steps required to create a new file. Hopefully, we remember to make the change the next time we modify the file.
Using the SQL "LABEL ON" statement, you can quickly and easily change the column headings or text without recompiling the file. You can, of course use SQL/400 to execute the statement, but you can also use Query Management/400. This means you can do this on any AS/400.
Before you run the LABEL ON statement, make sure you don't have any programs which depend on the values in the column headings or text. Changes to the values for these attributes are reflected in all files which share the record format. Typically, logical files share the record format with the physical file but they do not have to.
You must run the LABEL ON statement twice if you wish to change both column heading and text for a field.
To change a field's column headings, use a statement similar to the first one in 7. The character string for the column heading consists of three 20- byte segments (column heading 1 begins at byte 1, column heading 2 begins at byte 21 and column heading 3 begins at byte 41). The string can be no longer than 60 bytes. You can specify one, two, or three segments. You can even remove all column heading text by specifying a null string (''). In that case, programs such as QUERY/400 return the field name as the column heading.
To change a field's column headings, use a statement similar to the first one in Figure 7. The character string for the column heading consists of three 20- byte segments (column heading 1 begins at byte 1, column heading 2 begins at byte 21 and column heading 3 begins at byte 41). The string can be no longer than 60 bytes. You can specify one, two, or three segments. You can even remove all column heading text by specifying a null string (''). In that case, programs such as QUERY/400 return the field name as the column heading.
To change a field's text, use a statement similar to the second one in 7. The string in quotes can be no longer than 50 bytes.
To change a field's text, use a statement similar to the second one in Figure 7. The string in quotes can be no longer than 50 bytes.
You need to keep in mind that this method can cause your files to become unsynchronized with their corresponding DDS source. Whenever you use the LABEL ON statement to modify the column heading or text fields of a file, you should also change a file's DDS source member.
Change DDS COLHDG Values
Figure 7 Changing Column Headings and Text with SQL
To change a field's column heading: LABEL ON ARLIB/CUSTOMER (CUACT IS 'Column Heading 1 Column Heading 2 Column Heading 3') To change a field's text: LABEL ON ARLIB/CUSTOMER (CUACT TEXT IS 'Field-Text')
LATEST COMMENTS
MC Press Online