Editing Phrases

<editing phrase>

──┬─ G ─┬────────────────────────────────────────────────────────────┬─┤
  ├─ O ─┘                                                            │
  ├─ A ─┬─<field width>──────────────────────────────────────────────┤
  ├─ C ─┤                                                            │
  ├─ H ─┤                                                            │
  ├─ K ─┤                                                            │
  ├─ L ─┤                                                            │
  ├─ T ─┤                                                            │
  ├─ X ─┘                                                            │
  ├─ U ─┬─┬──────────────────────────────────────────────────────────┤
  ├─ V ─┘ └─<field width>─┬──────────────────────────────────────────┤
  │                       └─ . <decimal places> ─────────────────────┤
  ├─ S ──<scale factor>──────────────────────────────────────────────┤
  ├────────────────────┬─┬─ D ─┬─<field width>── . <decimal places> ─┤
  └─<editing modifier>─┘ ├─ E ─┤                                     │
                         ├─ F ─┤                                     │
                         ├─ R ─┘                                     │
                         ├─ I ─┬─<field width>───────────────────────┤
                         ├─ J ─┘                                     │
                         └─ Z ──<field width>─┬──────────────────────┤
                                              └─ . <decimal places> ─┘

<field width>

──┬─<unsigned integer>─┬───────────────────────────────────────────────┤
  └─ * ────────────────┘

<decimal places>

──┬─<unsigned integer>─┬───────────────────────────────────────────────┤
  └─ * ────────────────┘

<scale factor>

──┬─<integer>─┬────────────────────────────────────────────────────────┤
  └─ * ───────┘

<editing modifier>

  ┌◄────────────┐
──┴─┬─/1\─ P ─┬─┴──────────────────────────────────────────────────────┤
    └─/1\─ $ ─┘

Field Width

The field width specifies, in characters, the width of the field to be read or written. Because the field width specifies the entire length of the field to be used, if the <decimal places> variable is also specified, the field width value must allow for the number of decimal places requested plus one for the decimal point. Any field width value greater than 4029 results in a syntax error. Field width is covered further in the discussions of the individual editing phrase letters.

Decimal Places

The decimal places value specifies the number of characters following the decimal point in the field that are to be read or written. On input, the <decimal places> variable can be overridden by an explicit decimal point. A decimal places value greater than 4029 results in a syntax error. The decimal places value is covered further in the discussions of the individual editing phrase letters.

Variable Editing Phrases

A variable editing phrase is one that is not fully specified at compilation time. The format is processed from left to right at run time. If the letter V is encountered in an editing phrase, the next list element is accessed to provide an editing phrase letter. For more information, refer to “V Editing Phrase Letter” later in this section. If an asterisk (*) is encountered as the repeat part, field width, decimal places, or scale factor, then the next list element is accessed to provide an integer value for that specification. In addition to the list elements to be read or written, the I/O list must contain one list element for each V editing phrase letter and asterisk encountered in the editing specifications. The WRITE statements in the following examples use asterisks as both repeat parts and field widths to produce varying I editing phrases.

Examples of Variable Editing Phrases

WRITE(F, <I*>, IWIDTH, A);
WRITE(F, <3I*>, IWIDTH, A, B, C);
WRITE(F, <3(I*)>, IWIDTH1, A, IWIDTH2, B, IWIDTH3, C);

IREPEAT1 := 1;
IREPEAT2 := 2;
WRITE(F, <2(X1,*I*)>, IREPEAT1, IWIDTH1, A,
                      IREPEAT2, IWIDTH2, B, C);

When an asterisk is used as the repeat part, the number of repetitions performed depends on the value supplied by the list element. If the value of the list element is greater than 0 (zero), that number of repetitions is performed; if the value is equal to 0, an unlimited number of repetitions are performed. If the value is less than 0, no repetitions are performed, and control passes to the next editing phrase.

When an asterisk is used for the field width of an editing phrase, the actual width of the field depends on the value supplied by the list element. If the value of the list element is greater than 0 (zero), that value is used as the width of the field. If the value of the list element is less than or equal to 0, no editing is performed, the list elements corresponding to the editing phrase are skipped, and control passes to the next editing phrase.

Editing Phrase Letters

Every valid path through the editing phrase syntax requires an editing phrase letter that specifies how the data being read or written is to be edited. The editing phrase letters are as follows: A, C, D, E, F, G, H, I, J, K, L, O, R, S, T, U, V, X, or Z. An editing phrase that contains the editing phrase letter A is called an A editing phrase, an editing phrase that contains the editing phrase letter C is called a C editing phrase, and so on. Descriptions of the editing specified by each editing phrase letter are arranged in alphabetical order in the following paragraphs.

For ease of explanation, lowercase letters are used hereafter to refer to the values for the repeat part, field width, and decimal places as follows:

Letter

Meaning

r

<repeat part>

w

<field width>

d

<decimal places>

A list element of type COMPLEX is always edited as if it were two list elements of type REAL.

In the examples in the following sections, the lowercase letter b is used to denote a blank character.

A and C Editing Phrase Letters

The editing phrase letters A and C are used when reading or writing alphanumeric data. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, BOOLEAN, POINTER, and STRING.

When A is used, characters are read from, or written to, the word starting at the rightmost position. If C is used, the starting character position is the leftmost one.

In the explanations of the editing phrase letters A and C, the letter Q is used.

The value of Q is 6 for single-precision and 12 for double-precision, and if the list element is of the following form, then the value of the arithmetic expression is used as the value of Q:

<pointer expression> FOR <arithmetic expression>

On input, w characters are transferred from the input record to the pointer-designated location or string variable. On output, w characters are transferred from the pointer-designated location or string variable to the output record. The character size used is that of the pointer or string variable.

Input

On input, the editing phrase letters A and C specify that w characters of data are to be read from the input record and assigned to the corresponding list element.

For the editing phrase letter A, if w is greater than or equal to Q, the rightmost Q characters of the input field are transferred to the list element. If w is less than Q, then w characters of the input field are transferred right-justified to the list element. The unused high-order bits of the list element are set to 0 (zero).

The action specified by the editing phrase letter C is identical to that specified by the editing phrase letter A except that characters are read to the leftmost portion of the word.

The following are input examples for the A and C editing phrase letters. The default character type is 8-bit in all cases.

External String

Editing Phrase

Internal Value

ABCDEFGHIJKL

A9

8"DEFGHI"

AbCbEbGbIbK

A4

4"0000"8"AbCb"

ABCDEFGHIJKL

A12

ABCDEFGHIJKL (pointer as list element)

ABCDEFGHIJKL

A12

4"0000"8"ABCDEFGHIJKL" (8-bit pointer FOR 14)

ABCDEFGHIJKL

C9

8"DEFGHI"

ABCD

C4

8"ABCD"4"0000"

ABCDEFGHIJKL

C12

8"ABCDEFGHIJKL"4"0000" (8-bit pointer FOR 14)

The editing phrase letters A and C do not round values before assigning them to a list element. Therefore, a list element of type INTEGER or DINTEGER is not necessarily assigned an integer value. If w is greater than 4, the exponent field of the list element is affected; the result can be a noninteger value. The data representations of real and integer operands are discussed in Data Representation.

Output

On output, the editing phrase letters A and C Specify that the value of the corresponding list element is to be written as a character string to an output field that is w characters wide.

For the editing phrase letter A, if w is greater than or equal to Q and the list element is not a pointer expression, the Q characters of the list element are written right-justified with blank fill to the output field. If w is less than Q, the rightmost w characters of the list element are written to the output field. If any of the character fields in the word contain bit patterns that do not correspond to an EBCDIC graphic, then question marks (?) are written to those positions.

The action specified by the editing phrase letter C is identical to that specified by the editing phrase letter A except that characters are written from the leftmost portion of the list element.

The following are output examples for the A and C editing phrase letters:

External String

Editing Phrase

Internal Value

8"DEFGHI"

A9

bbbDEFGHI

4"0000000000"8"A"

A4

???A

8"ABCDEFG" (8-bit pointer FOR 7)

A11

bbbbABCDEFG

8"DEFGHI"

C9

bbbDEFGHI

8"ABCD"4"0000"

C5

ABCD?

8"ABCDEFG" (8-bit pointer FOR 7)

C11

bbbbABCDEFG

D Editing Phrase Letter

The editing phrase letter D is used for reading or writing floating-point values. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

Input

The editing phrase letter D specifies that w characters of input data are to be read, converted to a real value, and assigned to the corresponding list element. The input data must be in the form of a data number; otherwise, a data error is returned. A data number is defined syntactically as follows:

<data number>

──┬────────┬─┬─<decimal number>─┬──────────────────────┬───────────────┤
  └─<sign>─┘ │                  └─<data exponent part>─┤
             └─<data exponent part>────────────────────┘

<data exponent part>

──┬─ D ─┬─<integer>────────────┬───────────────────────────────────────┤
  ├─ E ─┤                      │
  ├─ @ ─┘                      │
  └─<sign>──<unsigned integer>─┘

The position of the decimal point in the internal value is determined by its position in the input data or by the value of d. If a decimal point appears in the input data, that position is used for the internal value. If no decimal point appears in the input data, one is assumed to be d places to the left of the D, E, at sign (@), plus sign (+), or minus sign (–) indicating the beginning of the exponent field. If no decimal point appears in the input data and an exponent is not present, a decimal point is assumed to be d places to the left of the right edge of the input field.

For example, if the editing phrase D7.2 is used to read the data number 10005.0, the resulting internal value is 10005.0. However, if the same editing phrase is used to read the data number 10005, the resulting internal value is 100.05.

The value of w must be greater than or equal to the value of d. Blanks are interpreted as zeros.

The following are input examples for the D editing phrase letter:

External String

Editing Phrase

Internal Value

bbbbbb25046

D11.4

+2.5046

bbbbb25.046

D11.4

+25.046

–bb25046E-3

D11.4

–0.0025046

–bbb25046-3

D11.4

–0.0025046

bb250.46D-3

D11.4

+0.25046

bbb250.46-3

D11.4

+0.25046

b–b25.04678

D11.4

–25.04678

Output

On output, the editing phrase letter D specifies that the value of the corresponding list element is to be converted to a string of characters that expresses the value in exponential notation. The string is written right-justified with blank fill to a field w characters wide. The value of the mantissa is rounded to the number of decimal places specified by d before it is written.

The value of w must be greater than or equal to d + 7. This width allows for a 4-character exponent part, a decimal point, a digit preceding the decimal point, and a sign. If w is less than d + 7, the field is filled with asterisks (*).

The editing phrase letter D always uses four or seven characters to represent the exponent of the list element being written. The magnitude of the exponent determines in which syntactic form the exponent is expressed:

Magnitude of Exponent

Form

4-character

D+xx or D–XX (where ABS(XX) <= 99)

4-character

+XXX or –XXX (where 100 <= ABS(XXX) <= 999)

7-character

D+XXXXX or D–XXXXX (where 1000 <= ABS(XXXXX) <= 99999)

The following are output examples for the D editing phrase letter:

External String

Editing Phrase

External String

+36.7929

D13.5

bb3.67929D+01

-36.7929

D12.5

-3.67929D+01

-36.7929

D11.5

***********

+36.7929

D10.5

**********

1.234@@-73

D14.5

bbb1.23400D-73

-789@@1234

D15.3

bb-7.890D+01236

6.54@@321

D9.2

b6.54+321

E Editing Phrase Letter

The action specified by the editing phrase letter E is identical to that specified by the editing phrase letter D except that the letter E, when used for output, indicates the beginning of the exponent in the output string.

The following are output examples for the E editing phrase letter:

External String

Editing Phrase

External String

+36.7929

E13.5

bb3.67929Eb01

–36.7929

E12.5

–3.67929Eb01

F Editing Phrase Letter

The editing phrase letter F is used when reading or writing floating-point values. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

Input

On input, the action specified by the editing phrase letter F is identical to that specified by the editing phrase letter D.

Output

On output, the editing phrase letter F specifies that the value of the corresponding list element is to be converted to a string of characters that expresses the value in simple decimal notation. The string is written right-justified with blank fill to a field w characters wide. The value of the list element is rounded to the number of decimal places specified by d before it is written.

The value of w must be greater than or equal to d + 1. When a program writes negative values, w must also allow for the minus sign (–). The field contains asterisks (*) if the value to be written requires a field wider than w characters.

The following are output examples for the F editing phrase letter:

External String

Editing Phrase

External String

+36.7929

F7.3

b36.793

+36.7934

F9.3

bbb36.793

–0.0316

F6.3

–0.032

0.0

F6.4

0.0000

0.0

F6.2

bb0.00

+579.645

F6.2

579.65

+579.645

F4.2

****

–579.645

F6.2

******

G Editing Phrase Letter

If used to read an EBCDIC file, the editing phrase letter G specifies that six 8-bit characters of the input data are to be skipped. If used to write to an EBCDIC file, the editing phrase letter G specifies that six EBCDIC zeros are to be written to the output record.

H and K Editing Phrase Letters

The editing phrase letters H and K are used when reading or writing hexadecimal and octal values, respectively. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

In the following explanation of the H and K editing phrase letters, the letter Q is used. The value of Q is derived from the following table:

 

Editing Phrase Letter

 
 

H

K

Single-precision

12

16

Double-precision

24

32

Input

The editing phrase letter H specifies that w characters of input data are to be read, converted to a hexadecimal value, and assigned to the corresponding list element. The editing phrase letter K specifies that w characters of input data are to be read, converted to an octal value, and assigned to the corresponding list element. When the letter H is specified, the input data must consist of only characters from the set of hexadecimal characters, the blank, or the minus sign (–). When K is specified, the input data must consist of only characters from the set of octal characters, the blank, or the minus sign (–). If other characters are used, a data error is returned. Leading, trailing, and embedded blanks are interpreted as zeros. If a minus sign appears in the input string, the value 1 is assigned to bit 46 of the list element (bit 46 of the first word of a double-precision list element).

If w is less than or equal to Q, the value is stored right-justified in the storage location. Both words of a double-precision variable are included. Unused high-order bits are set to 0 (zero). If w is greater than Q, the leftmost w – Q characters must be blanks, zeros, or minus signs; otherwise, a data error is returned.

The following are input examples for the H and K editing phrase letters:

External String

Editing Phrase

Internal Value

6F

H2

4"00000000006F"

1FFFFFFFFFFF

H12

4"1FFFFFFFFFFF"

–16

H3

4"400000000016"

1234b568

H8

4"000012340568"

FFCb

H4

4"00000000FFC0"

00C1C2C3C4C5C6

H14

4"C1C2C3C4C5C6"

–ABCD

H5

4"40000000000000000000ABCD" (double-precision)

123456789ABCDEF

H15

4"000000000123456789ABCDEF" (double-precision)

16

K2

3"0000000000000016"

1777777777777777

K16

3"1777777777777777"

–16

K3

3"2000000000000016"

1234b56

K7

3"0000000001234056"

77b

K3

3"0000000000000770"

–567

K4

3"20000000000000000000000000000567" (double-precision)

1234567654321234567

K19

3"00000000000001234567654321234567" (double-precision)

Output

On output, the editing phrase letter H specifies that the value of the corresponding list element is to be converted to a string of hexadecimal characters. The editing phrase letter K specifies that the value of the corresponding list element is to be converted to a string of octal characters. The output string is written right-justified with blank fill to a field w characters wide. If w is less than Q, only the contents of the rightmost w * 4 bits (when H is used) or w * 3 bits (when K is used) of the list element are converted. A double-precision list element is treated as 96 contiguous bits. The output string does not contain an explicit sign.

The following are output examples for the H and K editing phrase letters:

Internal Value

Editing Phrase

External Value

4"0000E5551010"

H5

51010

4"0000E5551010"

H12

0000E5551010

4"0000E5551010"

H16

bbbb0000E5551010

8"123456"

H12

F1F2F3F4F5F6

4"000000000000000012345678 (double-precision)

H4

5678

8"123456789bbb" (double-precision)

H24

F1F2F3F4F5F6F7F8F9404040

3"0005677701234445"

K5

34445

3"0005677701234445"

K16

0005677701234445

3"0005677701234445"

K18

bb0005677701234445

3"0000000000000000000000001234567" (double-precision)

K4

4567

I Editing Phrase Letter

The editing phrase letter I is used when reading or writing integer values. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

Input

The editing phrase letter I specifies that w characters of input data are to be read, converted to an integer value, and assigned to the corresponding list element. The data must be in the form of an ALGOL integer; otherwise, a data error is returned. Blank characters are interpreted as zeros. The magnitude of the value that can be read depends on the type of the list element.

The following are input examples for the I editing phrase letter:

Output

On output, the editing phrase letter I specifies that the value of the corresponding list element is to be converted to a character string in the form of an ALGOL integer. The string is written right-justified with blank fill to a field w characters wide. The value of the list element is rounded to an integer before it is written as output data.

Negative values are written with a minus sign (–); nonnegative values are written without a sign.

If the value of the list element requires a field larger than w, then w asterisks (*) are written.

The following are output examples for the I editing phrase letter:

Internal Value

Editing Phrase

External String

+23

I4

bb23

–79

I4

b–79

+67486

I5

67486

–67486

I5

*****

+978

I1

*

0

I3

bb0

+3.6

I2

b4

J Editing Phrase Letter

The editing phrase letter J is used when reading or writing integer values. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

Input

On input, the action specified by the editing phrase letter J is identical to that specified by the editing phrase letter I.

Output

On output, the editing phrase letter J specifies that the value of the corresponding list element is to be converted to a character string in the form of an ALGOL integer. The string is written to a field equal in width to the length of the string. The value of the list element is rounded to an integer before it is written.

Negative values are written with a minus sign (–); nonnegative values are written without a sign.

If w is less than the number of characters required to express the value of the list element, w asterisks (*) are written.

The following are output examples for the J editing phrase letter:

Internal Value

Editing Phrase

External String

+23

J5

23

–23

J5

–23

+233

J3

233

–233

J3

***

0

J3

0

3.14, –12

2J10

3–12

L Editing Phrase Letter

The editing phrase letter L is used when reading or writing Boolean values. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

Input

The editing phrase letter L specifies that w characters of input data are to be read, converted to one of the Boolean values TRUE or FALSE, and assigned to the corresponding list element. If the first nonblank character of the input data is the letter T, then bit 0 (zero) of the list element is assigned the value 1; otherwise, bit 0 is assigned the value 0 (zero). All other bits in the list element are assigned the value 0 (zero). An all-blank field yields the value FALSE. If the list element is a double-precision variable, the first word is assigned a value according to the rules just described, and the second word is set to 0 (zero).

The following are input examples for the L editing phrase letter:

External String

Editing Phrase

Internal Value

T

L1

TRUE (4"000000000001")

bbF

L3

FALSE (4"000000000000")

bbbTRU

L6

TRUE (4"000000000001")

b

L1

FALSE (4"000000000000")

T

L1

TRUE (4"000000000001000000000000") (double-precision)

Output

On output, the editing phrase letter L specifies that TRUE is to be written to the output record if bit 0 (zero) of the corresponding list element equals 1, and the letter L specifies that FALSE is to be written if bit 0 (zero) of the corresponding list element equals the number 0. If w is less than 5, the first w characters of TRUE or FALSE are written. If w is greater than 4, TRUE or FALSE is written right-justified with blank fill.

The following are output examples for the L editing phrase letter:

Internal Value

Editing Phrase

External String

0

L6

bFALSE

1

L5

bTRUE

2

L4

FALS

3

L3

TRU

4

L2

FA

O Editing Phrase Letter

The editing phrase letter O is used when data is to be read or written without editing. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, BOOLEAN, and POINTER.

In the following explanation of the editing phrase letter O, the letter Q is used. The value of Q is derived from the following table:

Precision

Pointers

   

 

Single

Double

4-bit

8-bit

EBCDIC

6

12

12

6

Input

The editing phrase letter O specifies that the input data is to be assigned to the corresponding list element without editing. Q characters of input data are read, unless the corresponding list element is of the following form:

<pointer expression> FOR <arithmetic expression>

When the list element is of this form, the value of Q and the value of the arithmetic expression are compared, and the lesser value is the number of characters read.

Output

On output, the editing phrase letter O writes the value of the list element as an unedited string of characters. Q characters are written to the output record unless the corresponding list element is of the following form:

<pointer expression> FOR <arithmetic expression>

When the list element is of this form, the value of Q and the value of the arithmetic expression are compared, and the lesser value is the number of characters written.

Example of Input and Output

The following example shows the use of the editing phrase letter O:

BEGIN
   FILE TD(KIND=REMOTE,MYUSE=IO);
   REAL R;
   READ(TD, <O>, R);
   WRITE(TD, <O>, R);
END.

Input and output data for this example are as follows:

Input

Output

A

A

ABCDEFGH

ABCDEF

R Editing Phrase Letter

The editing phrase letter R is used when reading or writing real values and can be used with the editing phrase letter S. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

Input

On input, the action specified by the editing phrase letter R is identical to that specified by the editing phrase letter D except when the letter R is immediately preceded by an S editing phrase.

Output

On output, the editing phrase letter R specifies that the value of the corresponding list element is to be converted to a string that expresses the value in either simple decimal or exponential notation.

In general, if w is greater than or equal to the number of characters required to express the value of the list element using simple decimal notation, then simple decimal notation is used. If w is less than the number of characters required to express the value using simple decimal notation and greater than or equal to the number of characters required to express the value using exponential notation, then exponential notation is used. If w is less than the number of characters required to express the value using exponential notation, the field is filled with asterisks (*).

Examples of Input and Output

External Input String

List Element Type

Editing Phrase

External Output String

–.333333bb

REAL

R10.4

bbb–0.3333

–.333333bb

DOUBLE

R10.4

bbb–0.3333

–.333333bb

INTEGER

R10.4

bbbb0.0000

3333.333E2

DOUBLE

R10.4

3.3333D+05

3333.333E2

INTEGER

R10.4

3.3333E+05

–.333bbbbb

REAL

R10.9

**********

–.333bbbbb

INTEGER

R10.9

.000000000

333.333E2b

DOUBLE

R10.4

3.3333D+22

bbbbbbbbbbbbb1.23D12

REAL

R20.4

bb1230000000000.0000

bbbbbbbbbb1.23D12345

DOUBLE

R20.4

bbbbbbb1.2300D+12345

bbbb4.3@68

REAL

R10.4

4.3000E+68

S Editing Phrase Letter

The editing phrase letter S is used with an R editing phrase to provide a scale factor.

If the next editing phrase in the editing specifications does not contain the editing phrase letter R, the S editing phrase is ignored. When more than one S editing phrase appears in the editing specifications, each subsequent S editing phrase takes precedence over the preceding one.

Input

On input, the value of the input data corresponding to the subsequent R editing phrase is divided by the following number before the input data value is assigned to the list element:

10 ** <scale factor>

The following are input examples for the S editing phrase letter:

External String

Editing Specifications

Internal Value

bbbb10000.

S2,R10.2

100.0

bbbbbb5.41

S1,R10.2

0.541

bbbbbb05.5

S1,R10.2

0.55

bbb5.01521

S–1,R10.2

50.1521

bbbbbbb541

S1,R10.2

0.541

Output

On output, the value of the list element corresponding to the subsequent R editing phrase is multiplied by the following number before the list element value is written to the output field:

10 ** <scale factor>

The following are output examples for the S editing phrase letter:

Internal Value

Editing Specifications

External String

100.0

S2,R10.2

bb10000.00

0.54

S1,R10.2

bbbbbb5.40

0.0056

S1,R10.2

bbbbbb0.06

1.55

S-1,R10.2

bbbbbb0.16

T Editing Phrase Letter

The editing phrase letter T specifies that the buffer pointer is to be moved to character position w of the input or output record. The value of w must be greater than 0 (zero); if w is equal to 0, the buffer pointer is moved to the first character position in the record. No list element corresponds to this editing phrase letter.

Input Examples

External String

Editing Specifications

Internal Value

012345678910111213

T13,I3

111

012345678910111213

T1,I4

123

012345678910111213

T15,I4

1213

ABCDEFGHIJKLMNOPQR

T8,A6

HIJKLM

Output Example

BEGIN
   FILE DCOM(KIND=REMOTE,MYUSE=IO);
   ARRAY A[0:9];
   WRITE(DCOM, <T11,I3,T2,I3>, 123, 456);   % WRITE STATEMENT 1
   WRITE(DCOM, <T4,A3,T1,A2>, "ABC", "DE"); % WRITE STATEMENT 2
END.

This program produces the following output:

WRITE statement 1:  b456bbbbbb123
WRITE statement 2:  DEbABC

U Editing Phrase Letter

The editing phrase letter U specifies that output data is to be edited as best suits the type of the corresponding list element. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN, STRING, POINTER.

Input

The editing phrase letter U is not implemented for input.

Output

On output, real, integer, and double-precision list elements are written using a format that combines readability with maximum numerical significance. Boolean values are written as T or F and occupy one character position in the record. String literals are treated as real values. If the number of characters required to express the list element is greater than the number left in the current record, the output is placed in the next record.

If w is specified and the number of characters required to express the list element is greater than w, the field is filled with asterisks (*).

If d is specified and d is greater than w, then d – w leading blanks are inserted in the value that is written to the list element before the field is written.

Thus, when the editing phrase letter U is used, the number of characters actually written cannot be less than d and can be greater than w.

The following are output examples for the U editing phrase letter:

Internal Value

Editing Specifications

External String

–123.4567

U

–123.4567

789

U

789

1.5@@275

U10

1.5D+275

1234567

U5

1.2+6

1

U10.4

bbb1

123.456

U10.4

123.456

1

U5.8

bbbbbbb1

123.456

U5.8

bbb123.5

V Editing Phrase Letter

The editing phrase letter V allows the type of editing to be specified at run time. The rightmost character of the first word of the next list element (or, if the list element is a pointer, the character pointed at) provides the editing phrase letter to be used to edit the data. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, BOOLEAN, and POINTER.

The editing phrase letter extracted from the list element is an 8-bit character.

Example of V Editing Phrase Letter

In the following program, FMT1 in the first READ statement evaluates to R8.2 and corresponds to the list element A; FMT2 in the WRITE statement evaluates to 2A6 and corresponds to the list elements A and I; and FMT3 in the second READ statement evaluates to 2E10.4 and corresponds to the list elements A and B.

  .
  .
  .
REAL A,B;
INTEGER I;
FORMAT FMT1(V8.2),
       FMT2(2V*),
       FMT3(*V*.*);
  .
  .
  .
READ(KARD,FMT1,"R",A);
B := 4"C1";
WRITE(LINE,FMT2,B,6,A,I);
I := 4"C5";
READ(KARD,FMT3,2,I,10,4,A,B);
  .
  .
  .

For more information, see “Variable Editing Phrases” earlier in this section.

X Editing Phrase Letter

On input, the editing phrase letter X specifies that w characters of input are to be skipped. On output, the editing phrase letter X specifies that w blanks are to be written. No list element corresponds to this editing phrase letter.

Z Editing Phrase Letter

The editing phrase letter Z is used when reading or writing real values. Valid list elements are of type INTEGER, REAL, DINTEGER, DOUBLE, COMPLEX, and BOOLEAN.

Input

On input, the editing phrase letter Z selects one of the editing phrase letters D, I, or L to specify the editing action, depending on the type of the corresponding list element, as shown in the following table:

Type

Editing Phrase

REAL or DOUBLE

Dw.d

INTEGER or DINTEGER

Iw

BOOLEAN

Lw

Output

The output string has a length of w characters regardless of the value or type of the list element being written. For Boolean list elements, Lw is used. For integer or dinteger list elements, Iw is used. For real or double list elements, editing with D, E, or F editing phrase letters is performed depending on the type of the list element and the magnitude of its value.

The following are output examples for the Z editing phrase letter:

Internal Value

Editing Phrase

External String

1.23@@250

Z12.6

1.230000+250

1

Z5.1

bbbb1

12345

Z5.1

12345

12

Z8.7

bbbbbb12

12345.678

Z10.4

1.2346E+04

12

Z10.4

bbbbbbbb12

12345678

Z6

******

1234

Z6

bb1234