- THE PL/I NEWSLETTER - |
- THE PL/I NEWSLETTER - |
- THE PL/I NEWSLETTER - |
The sixth issue may be downloaded from:
The PL/I Newsletter, No. 6, December 2002.
The fifth issue may be downloaded from:
The PL/I Newsletter, No. 5, August 2002.
The fourth issue may be downloaded from:
The PL/I Newsletter, No. 4, November 2001.
The third issue may be downloaded from:
The PL/I Newsletter, No. 3, June 2001.
The second issue may be downloaded from:
The PL/I Newsletter, No. 2, September 2000.
The first issue may be downloaded from:
The PL/I Newsletter, No. 1, July 2000.
Click the above link for the document, and download the PL/I Header files for Windows.
iSUB may be used to simplify some operations involving arrays.
iSUB may be used to define two or more arrays that share the same storage.
For example, suppose a square matrix A exists of size 10 × 10. We may specify a second array D of size 10 that references only those elements on the diagonal. The declaration is:
In another instance, suppose a matrix has zero elements everywhere except for those on the diagonal. iSUB may be used in such a way that only those diagonal elements are held in storage, with a considerable saving in storage. However, iSUB allows that matrix to be referenced as if all elements (including the zero elements) were held in storage.
The next example declaration reserves storage for the diagonal elements and provides the means to reference all elements of the matrix B.
The statement PUT (A); will print only 11 elements, while the statement PUT (B); will print all 100 elements of the matrix. But note that only 11 elements of the matrix are stored.
The following declaration will allow access to elements of the other diagonal (from the top right-hand corner to the bottom left-hand corner).
In a symmetric matrix, the elements above the diagonal are the mirror image of those below the diagonal. In other words, element A(i,j) = A(j,i) for all i ^= j.
Under these circumstances, only the diagonal elements and all those below the diagonal need to be stored. For an n × n matrix, the storage required is n(n-1)/2 elements (or just over one-half the number of elements in the full matrix.
We may therefore define a vector consisting of n(n-1)/2 elements, and we may define an n × n matrix that accesses those elements. This is possible because the position of an element (i,j) is given by the formula i*(i-1)/2+j. Thus:
This declaration permits the matrix A to be referenced by A(i,j) provided that i <= j.
An alternative declaration is required when the the diagonal and those elements above it are stored instead. This requires a more involved formula.
For both declarations, however, the formula needs to be modified if all elements of the matrix A are to be referenced (that is, if A(i,j) is to be used for all values of i and j.
The declaration for the lower triangular form thus becomes:
Upper Triangular Matrix
If the matrix is upper triangular (that is, all elements below the diagonal are zero), the following declaration may be used to define storage for the matrix:
If it is desired to reference all elements of the array -- including the zero-valued elements beneath the diagonal, the following declaration and assignment would be required:
Submatrix
An interesting application is to define a sub-matrix. Consider the declaration
Cyclic Shift
To perform a cyclic shift or rotation of the elements of a matrix, the following declaration would suffice. This declaration assumes that the number of shifts is held in the variable Shift.
Other possibilities include obtaining the elements of a vector in reverse order:
References:
C. T. Fike, PL/I for Scientific Programmers, Prentice-Hall,
Englewood Cliffs, N. J., 1970, pp. 57-58, 125.
IBM, OS/2 PL/I Version 2 Programming: Language Reference, 3rd Ed.,
ref. SC26-4308-2, 1990, pp. 160-164.
IBM, Enterprise PL/I for z/OS amd OS/390 Language Reference,
Version 3 Release 1.0, 3rd Ed.,
ref. SC27-1460-00, 2001, pp. 260-264.
VisualAge PL/I Enterprise Edition Version 2.1 combines the two separate offerings from the previous release of VisualAge PL/I (Standard and Professional) into a single offering available on both the OS/2 and Windows NT platforms. By doing so, it provides these productivity features:
Also included as an extra bonus offering is VisualAge CICS® Enterprise Application Development, which enables CICS host application development on the workstation.
To display a progress summary on the same line on the PC screen, use the following:
You will neeed to have ANSI.SYS loaded.