PUT data-directed
For more information about the PUT statement, see PUT statement.
A data-list item can be an element, array, or structure variable, or a repetitive specification. The names appearing in the data list, together with their values, are transmitted in the form of a list of element assignments separated by blanks and terminated by a semicolon. For PRINT files, items are separated according to program tab settings; see PRINT attribute.
A semicolon is written into the stream after the last data item transmitted by each PUT statement.
put data (<.A>B<.Ckk>);
would be transmitted as:
ABC<kk>=value-of-variable
Data-directed output is not valid for subsequent data-directed input when the character-string value of a numeric character variable does not represent a valid optionally signed arithmetic constant, or a complex expression.
For character data, the contents of the character string are written out enclosed in quotation marks. Each quotation mark contained within the character string is represented by two successive quotation marks.
declare (A(6), B(7)) fixed;
get file (X) data (B);
do I = 1 to 6;
A (I) = B (I+1) + B (I);
end;
put file (Y) data (A);
input stream:
B(1)=1, B(2)=2, B(3)=3,
B(4)=1, B(5)=2, B(6)=3, B(7)=4;
output stream:
A(1)= 3 A(2)= 5 A(3)= 4 A(4)= 3
A(5)= 5 A(6)= 7;
dcl 1 A,
2 B FIXED,
2 C,
3 D FIXED;
A.B = 2;
A.D = 17;
put data (A);
A.B= 2 A.C.D= 17;