Chapter 11. The External Data Queue, or "Stack"

Overview

Most Rexx interpreters support an in-memory data structure called the external data queue, or stack. It is a general-purpose mechanism for passing data — between routines, programs, scripts and the operating system, and other entities.

A number of instructions and built-in functions manipulate the stack: pull, parse pull, push, queue and the queued built-in function. This chapter covers those instructions.

The stack evolved from Rexx's mainframe origins. Mainframe operating systems supported the stack as an integral feature of the environment, so it was only natural that Rexx support this key operating system feature. If you use mainframe Rexx you employ the stack to send commands to the operating system, to retrieve the results from those commands, for interprogram communication, and for other purposes.

Few operating systems other than those on mainframes support a stack. Rexx interpreters, therefore, come with their own "stack service" that mimics how Rexx operates with the mainframe stack.

Depending on your operating system and your Rexx interpreter, you may or may not end up using the stack. Nevertheless, it is important to know about it for several reasons. First, much Rexx documentation mentions the stack. If you don't know about it or understand it, understanding Rexx documentation becomes difficult. Second, the stack is a built-in feature of Rexx interpreters that has some good uses. For example, it's pretty common to use ...

Get Rexx Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.