PL/I to IDL Mapping

This document describes how PL/I data types, their attributes and related syntax are mapped to Software AG IDL data types by the IDL Extractor for PL/I. It covers the following topics:


IDL Extractor for PL/I Input

PL/I source code is the input for IDL generation. The IDL Extractor for PL/I inspects the parameter definition of PL/I procedures or PL/I functions and their DECLARE statements.

The sources

  • must contain external PL/I procedures or PL/I functions;

  • must be free of preprocessor statements;

  • must be compiled with no errors and no warnings.

IDL Extractor for PL/I Output

The IDL Extractor for PL/I generates:

  • the Software AG IDL file name by adding the extension ".idl" to the PL/I source file name without extension;

  • the Software AG IDL library name from the PL/I source file name without extension;

  • the Software AG IDL program name from the name of the PL/I external procedure or function.

Mapping PL/I Data Types to Software AG IDL

The IDL generator maps the following subset of PL/I data types to IDL data types, other PL/I data types as transfer parameters are not supported. If the PL/I source file contains parameters which cannot be mapped to IDL parameters, an IDL file with incorrect IDL syntax will be created.

The following metasymbols and informal terms are used for the Software AG IDL in the table below.

  • The metasymbols "[" and "]"enclose optional lexical entities.

  • The metasymbols "(" and ")" enclose numeric expressions which must be evaluated.

  • The informal term n and m is a sequence of numeric characters, for example 123.

  • The metasymbols "*" and "/" represent a numeric expression which must be evaluated for the real number.

PL/I Data Type Software AG IDL Description Notes
CHARACTER (n) An Alphanumeric 1
CHARACTER (*) AV Alphanumeric variable length  
CHARACTER (n) VARYING AVn Alphanumeric variable length with maximum length 1
GRAPHIC (n) K(n*2) Kanji fixed length 2
GRAPHIC (*) KV Kanji variable length  
GRAPHIC (n) VARYING KV(n*2) Kanji variable length with maximum length 2
BIT (n) B(n/8) Binary 3
BIT (*) BV Binary variable length  
FLOAT BINARY
FLOAT BINARY (21)
FLOAT DECIMAL
FLOAT DECIMAL(6)
F4 Floating point (small)  
FLOAT BINARY (53)
FLOAT DECIMAL (16)
F8 Floating point (large)  
FIXED BINARY
FIXED BINARY (7)
I1 Integer (small)  
FIXED BINARY (15) I2 Integer (medium)  
FIXED BINARY (31) I4 Integer (large)  
BIT
BIT (1)
L Logical  
PIC 'S(m)9[V(n)9]' Nm[.n] Unpacked decimal 4
PIC '(m)9[V(n)9]' NUm[.n] Unpacked decimal unsigned 4
FIXED DECIMAL (m,n) P(m-n)[.n] Packed decimal 5

Notes:

  1. n is the number of graphic characters (DBCS).
  2. n is the number of DBCS characters.
  3. n is the number of bits and n must be a multiple of 8.
  4. m,n, are numbers, where n <=7, n<=29 and m+n <=29.
  5. m,n, are numbers, where n <=7 and m <= 29.

Functions

The function return value of a PL/I external function will be mapped to an additional parameter "Function_Result" with the direction out; this parameter will be appended to the last parameter of the procedure.

For example, the external function R_CHAR

R_CHAR:  PROCEDURE (p) RETURNS ( CHAR (20) ) ;
          PUT SKIP LIST('R_CHAR $dollar;Revision: n.n $');
          DCL p CHAR(10);
          RETURN (p);
 END R_CHAR;

will be mapped to the Software AG IDL program:

program 'R_FLOAT' is
      define data parameter
      1 p     (F4)      In Out
      1 Function_Result         (F4)      Out
      end-define

Structures

Structures are mapped to Software AG IDL groups. Asterisks as fillers or reserved items are not supported.

declare 1 Payroll, 				
          2 Name, 					
                       3 Last char(20), 			
                       3 First char(15),
          2 Hours,
                       3 Regular fixed dec(5,2),
                       3 Overtime fixed dec(5,2),
          2 Rate,
                       3 Regular fixed dec(3,2),
                       3 Overtime fixed dec(3,2);

will be mapped to Software AG IDL

1 Payroll In Out
 2 Name 	
  3 Last (A20)
  3 First (A15)
 2 Hours 	
  3 Regular (P3.2)
  3 Overtime (P3.2)
 2 Rate 	
  3 Regular (P1.2)
  3 Overtime (P1.2)

Arrays

Arrays are mapped to Software AG IDL arrays. The dimension of an array is restricted to 3.

DCL A CHAR(10) DIMENSION (100);
DCL B CHAR(10) DIMENSION (*);
DCL C CHAR(10) DIMENSION (-5:10);
DCL D CHAR(10) DIMENSION (10,10,10);

will be mapped to

1 A (A10/100)      In Out
1 B (A10/V)        In Out
1 C (A10/16)       In Out
1 D (A10/10,10,10) In Out

Aligned

The ALIGNED attribute will be mapped to the Software AG IDL attribute aligned. See attribute-list under Software AG IDL Grammar in the IDL Editor documentation.

PL/I to IDL Restrictions

The following table lists features, clauses and items that are not supported by the IDL Extractor for PL/I:

Item Description
PL/I Preprocessor MACRO preprocessor for PL/I source program alteration. It is executed prior to compilation
UNALIGNED attribute The UNALIGNED attribute reduces to one byte the alignment requirements for halfwords, fullwords, and doublewords and it reduces to one bit the alignment requirement for bit strings.