Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
On behalf of my team leader (who really should have known the difference), a teachable moment.
The code:
Code: |
foo24: proc options (main) reorder;
/********************************************************************/
/* */
/* Written Heisei 23.11.01 by Akatsukami-sama */
/* */
/* Illustrates the difference between fixed-length and */
/* variable-length character variables. */
/* */
/********************************************************************/
dcl qual1 char (60),
qual2 char (60) var,
work char (20),
(i, j, k) fixed bin (31);
qual1 = 'ABCDEFGHIJ';
qual2 = 'ABCDEFGHIJ';
work = 'ZYXWVUTSRQ';
i = 2;
j = 4;
qual1 = qual1 || '.' || substr(work,i,j);
qual2 = qual2 || '.' || substr(work,i,j);
put skip edit ('qual1 is [', qual1, ']') (a, a, a);
put skip edit ('qual2 is [', qual2, ']') (a, a, a);
end foo24; |
The output:
Code: |
qual1 is [ABCDEFGHIJ ]
qual2 is [ABCDEFGHIJ.YXWV] |
|
|