Specifying column attributes

Using the SPECIFY command, you can change the alignment of a column heading or the data within a column, or you can define a column. There are two ways to access the alignment and definition panels.

Column alignment

If you specify alignment, a small panel overlays the FORM.COLUMNS panel showing the alignment specifications for the column you chose. For example:

                         Alignment
  Column number   :    3
  Column Heading  :  DEPT_HEADING_CAN_BE UP TO_40 CHARS LONG!
 
  Heading alignment  :  [DEFAULT  ]
  Data alignment     :  [LEFT     ]
 
 _________________________________________________________
  F1=Help  F5=Previous Column  F6=Next Column  F12=Cancel
 

Choices for heading and data alignment are LEFT, RIGHT, CENTER, and DEFAULT. The default for the heading and data of a column containing character data is right-justified, while the default for the heading and data of a column containing numeric data is left-justified.

To change an alignment value, type the new value over the current value. Use the tab key to move between the heading and data alignment entry fields. from one column alignment specification to another.

Column alignment applies mainly to tabular data. However, if you use _B with a substitution variable, the data is aligned as follows:

  1. The data is edited according to the edit code and width of the column.
  2. If the alignment is not DEFAULT, leading and trailing blanks are removed.
  3. The value is aligned according to the specified alignment value.

In tabular reports, leading and trailing blanks are removed if the value for data alignment is LEFT, RIGHT, or CENTER. The blanks are not removed if the data alignment value is DEFAULT.

If you are using edited character data with leading blanks, or edited numeric data with trailing blanks, the blanks are not removed regardless of the alignment value.

Column definition

Note to CICS users

Column definition is not available in CICS, because its function depends on REXX.

Column definition allows you to define a new column of data using an expression. There are some differences between columns retrieved by a query and columns you define. The main difference is in the data type and length assigned to user-defined columns.

When you define a column, you are prompted to enter an expression to define the column and whether null values should be included when REXX evaluates the expression. QMF determines the data type and column length based on the edit code and column width specified for that column on FORM.COLUMNS. However, if you use a usage code for the defined column that does not agree with the edit code for the column, the usage code determines the data type.

Another difference between user-defined columns and those retrieved from the database is that values for user-defined columns are not retained when the data is saved or exported.

Column wrapping can also appear to work differently for defined columns.

A LONG VARCHAR column can only have a usage code of OMIT (or be left blank).

When you specify Definition from FORM.COLUMNS, a panel is displayed where you can enter an expression (up to 50 characters) defining your new column. For example:

                           Definition
 
    Column number :     8
    Column Heading:   Total Earnings
 
    Type an expression to define this column.
    Expression  [ totearn(&6 &7)                                ]
    Pass Nulls? [ YES    ]
   _____________________________________________________________
    F1=Help  F5=Previous Column  F6=Next Column
    F10=Previous Definition  F11=Next Definition  F12=Cancel
 

You can define the new column in terms of:

If you include a REXX expression in your column definition, you might receive unexpected results if the value returned by REXX is longer than 32,767 characters.

Use the Previous and Next function keys to move from one column definition panel to another.

PASS NULLS

If the PASS NULLS question is answered YES, you can use the following QMF-provided values to change the default handling in the corresponding situations:

Value
Situation
DSQNULL
Data is null
DSQUNDEF
Data is undefined
DSQOFLOW
Data has numeric overflow
DSQNOINS
Data has no instance
DSQNOREL
Data has no relationship

For example, any database variable that is null (a database null) is replaced with the character string DSQNULL before the expression is passed to REXX for evaluation. You can provide a REXX expression or exec that checks for the string and substitutes 0 (or whatever is appropriate for your purpose) for the database null.

If a null value is returned by the REXX expression, you can pass it to your report.

If PASS NULLS is set to YES and the expression contains a substitution variable that is null, undefined, overflow, has no instance or no relationship, then the entire expression will be set to the value that represents that condition. This expression reduction is performed only on expressions, not comparisons. For more information, see the @IF function.

If the PASS NULLS answer is NO, a null is returned for the values listed above. Nothing is passed to REXX for evaluation.

Edit codes and data types

QMF determines the data type and column length of a defined column based on the edit code and column width specified for that column on the FORM.COLUMNS panel. Table 12, following, summarizes the results.

Table 12. Edit codes and data types
Edit Code Data Type
Column width <=254 Column width >=255
Character (C, CW, CT, CDx, B, BW, X, XW) VARCHAR (max. length=254 LONG VARCHAR (max. length=32767)
Numeric (D, E, I, J, K, L, P) Numeric - Extended floating point
U and V user edit codes (no numeric usage) VARCHAR (max. length=254) LONG VARCHAR (max. length=32767
U and V user edit codes (at least one numeric usage) Numeric - Extended floating point

SQL/DS and DB2 databases do not support an extended floating point data type. Therefore, you might find it advantageous to define a numeric column as extended floating point, for example, when working with data that would ordinarily cause an overflow condition if it were used as a database data type (such as DECIMAL or INTEGER).

[ Previous Page | Next Page | Contents | Index ]