Rational Developer for System z
Enterprise PL/I for z/OS, Version 3.8, Language Reference Manual

A-format item

The character (or A) format item describes the representation of a character value.

Read syntax diagramSkip visual syntax diagram>>-A--+---------------+----------------------------------------><
      '-(field-width)-'
 
field-width
Specifies the number of character positions in the data stream that contain (or will contain) the string. It is an expression that is evaluated and converted to an integer value, which must be nonnegative, each time the format item is used.

If an A-format item is specified without a length in a GET EDIT statement, the compiler issues a warning message and treats it as an L-format item (rather than issuing an error message and assigning it a length of 1).

On input, the specified number of characters is obtained from the data stream and assigned, with any necessary conversion, truncation, or padding, to the data-list item. The field width is always required on input and, if it is zero, a null string is obtained. If quotation marks appear in the stream, they are treated as characters in the string.

Consider the following example:

  get file (Infile) edit (Item) (A(20));

The GET statement assigns the next 20 characters in Infile to Item. The value is converted from its character representation specified by the format item A(20), to the representation specified by the attributes declared for Item.

On output, the data-list item is converted, if necessary, to a character string and is truncated or extended with blanks on the right to the specified field-width before being placed into the data stream. If the field-width is zero, no characters are placed into the data stream. Enclosing quotation marks are never inserted, nor are contained quotation marks doubled. If the field width is not specified, the default is equal to the character-string length of the data-list item (after conversion, if necessary, according to the rules given in Data conversion).


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)