Browse Prior Art Database

Testchoice Function

IP.com Disclosure Number: IPCOM000082330D
Original Publication Date: 1974-Nov-01
Included in the Prior Art Database: 2005-Feb-28
Document File: 1 page(s) / 11K

Publishing Venue

IBM

Related People

Melkun, BF: AUTHOR

Abstract

FORTRAN has a conditional GOTO statement based on comparing a value to phi and selecting a label based on comparisons of less than, equal to, or greater than. PL/I must use a nested If structure to achieve the same results. An example is: If x <0 then - - - / * less than path * / Else If x 0 then - - - / * equal path * / Else - - - / * greater than path * /. This structure is difficult to recognize and optimize, for example, because of possible side effects to x, leading to inefficient and less meaningful programming.

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

Page 1 of 1

Testchoice Function

FORTRAN has a conditional GOTO statement based on comparing a value to phi and selecting a label based on comparisons of less than, equal to, or greater than. PL/I must use a nested If structure to achieve the same results. An example is: If x <0 then - - - / * less than path * / Else If x 0 then - - - / * equal path * / Else - - - / * greater than path * /. This structure is difficult to recognize and optimize, for example, because of possible side effects to x, leading to inefficient and less meaningful programming.

To simplify the use of comparisons, PL/I may have a built-in function, TESTCHOICE, of the following form: TESTCHOICE (leftexpression,rightexpression,LTorNEvalue,EQvalue[, Gvalue]).

The first two operands leftexpression and rightexpression are the values to be compared. There are either two or three other operands.

If there are two other operands, these are the function return values for notequal and equal, respectively. If there are three other operands, these are the function return values for less than, equal, and greater than, respectively. All function return values must be the same data type.

This function can be used, for example, directly in the PL/I GOTO statement to get the FORTRAN conditional GOTO, by using three operand values: FORTRAN PL/I If (A) 1,2,3 GOTO TESTCHOICE (A,phi,LI,L2,L3); This is only one example and the function can be used in any expression position.

1