Browse Prior Art Database

Keyword Arguments in PL/I

IP.com Disclosure Number: IPCOM000081035D
Original Publication Date: 1974-Mar-01
Included in the Prior Art Database: 2005-Feb-27
Document File: 1 page(s) / 12K

Publishing Venue

IBM

Related People

Healey, MJ: AUTHOR

Abstract

PL/I programmers sometimes have difficulty passing parameters to subroutines, because of the restrictive rules applying to arguments. The programmer must know all of the parameters expected by the called routine, and they must be specified all in the correct order. In practice, this makes passing more than about half a dozen values in one invocation an error-prone activity.

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

Page 1 of 1

Keyword Arguments in PL/I

PL/I programmers sometimes have difficulty passing parameters to subroutines, because of the restrictive rules applying to arguments. The programmer must know all of the parameters expected by the called routine, and they must be specified all in the correct order. In practice, this makes passing more than about half a dozen values in one invocation an error-prone activity.

It is useful to have a method for introducing into PL/I programs a keyword notation for argument passing. This allows the user to pass as many values as is desired, in any order which suits him, leaving parameters not mentioned to take on default values.

If a user needs to call a procedure X which allows for 25 parameters, the procedure can be called in any of the following ways: CALLX (J=15; P=49; TITLE='RESULTS');

CALLX (TITLE='RESULTS'; J=15);

CALLX (P=49);.

CALLX is a PL/I macro which expands to a series of statements, in which default values are assigned to all 25 arguments to be passed to X; the string of PL/I assignment statements passed as an argument to CALLX is then executed, causing some of the default assignments to be overridden; finally, X itself is called with 25 properly set up arguments. The keywords used in the CALLX statement are variables which may have program-wide scope, or which can be local to the macro expansion if BEGIN . . . . END logic is used.

The expansion may seem cumbersome, but it should be remembered that the default assignments are n...