Browse Prior Art Database

Using PL/I Declares in APL

IP.com Disclosure Number: IPCOM000052148D
Original Publication Date: 1981-May-01
Included in the Prior Art Database: 2005-Feb-11
Document File: 2 page(s) / 14K

Publishing Venue

IBM

Related People

Crockett, JD: AUTHOR [+2]

Abstract

The objective is to create APL variables which can be used to index dat whose format is defined by PL/I declarations.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 56% of the total text.

Page 1 of 2

Using PL/I Declares in APL

The objective is to create APL variables which can be used to index dat whose format is defined by PL/I declarations.

For example, for the following PL/I declaration:

DCL

1 W CHAR(1),

2 X BIT(4),

2 Y BIT(2),

1 Z FIXED(8); we wish to generate the APL variables WI, XI, YI and Z1 with the following values:
WI = 0 1 2 3 4 5 6 7 YI = 4 5
XI = 0 1 2 3 ZI = 8 9 10 11 12 13 14 15

The approach taken is to mechanically create an APL function that would cause the desired assignment when executed. This created function, in turn, calls other APL functions, one for each name in the original declaration. These auxiliary APL functions take two arguments and have names based on the original declaration types, e.g., CHAR, PTR, etc. The two arguments passed to these auxiliary functions are: 1. Level within the declare.

2. Length of the data.

The declaration shown above, for example, results in the following APL functions:
See Original p5326

It will be noted in the above example that for each level in the declaration, a "base variable" (whose name is formed by the word 'BASE' concatenated with the level number, e.g., BASE3) is maintained. These variables are used to keep track of the particular bit at which assignments are being made for each level of the declaration. Whenever the declaration increases in depth (i.e., the level becomes higher), it is necessary to reset the base variable for that higher level. This is done using a variable OLD, which is given its initial value when the function is invoked, and thereafter is updated by the auxiliary functions (i.e., BIT, CHAR, etc). Since OLD is given its initial value when the APL function is invoked, it is effectively used as the equivalent of a PL/I pointer.

The auxiliary functions (CHAR, BIT. etc.) perform the actual determination of the desired bit positions using the specified length and the current value of the base variable for the specified level. In addition, the value of the base variable is saved...