vs 4.00, January 2003)Rexx2Nrx.Rexx2RT.RexxStk (
The class RexxStk emulates the classix REXX verbs PUSH, PULL, and QUEUE, as well as the builtin function QUEUED(). AS PULL may also be used in the PARSE PULL construct, the option to UPPERCASE convert the result is provided as well.
In the IBM CMS implementation of REXX, the system commands 'MAKEBUF' and 'DESBUF' may be used to create a 'new' Stack, making and destroying the new buffer, respectively. These methods are included for your convenience.
For short reference, the best approach is to put RexxStk to the USES list of your NetRexx program, e.g.:
Import Rexx2Nrx.Rexx2RT.RexxStk
Class class-name[parameters] USES RexxStk, ...
In summary, the following methods are available:
method push(line=Rexx '') public static
pushes the given line to the current Stack. Note that the Rexx Stack is concurrently acting as a Stack and as a Queue. Push puts something on the top (LIFO). Queue to the bottom (FIFO).
method pull() public static returns Rexx
returns the next line of the internal Stack, without uppercase conversion (as is the case with the classic REXX verb 'PARSE PULL'). If no more lines are present in the Stack, an input line from the CONSOLE is requested.
You may obtain the number of pending lines in the Stack by using the queued() function (see below)
method pull_upper() public static returns Rexx
returns the next line of the internal Stack, but with uppercase conversion (as is the case with the classic REXX verb 'PULL'). If no more lines are present in the Stack, an input line from the CONSOLE is requested.
You may obtain the number of pending lines in the Stack by using the queued() function (see below)
method queue(line=Rexx) public static
appends (queues) the given line to the current Stack. The last queued line will be retrieved latest (FIFO).
method queued() public static returns int
returns the total number of queued (stacked) lines. You may use the result of the queued function to inquire the number of 'pending lines' in the Stack.Note that queued returns the sum of the pending lines of all buffer levels, when makebuf and desbuf have been used.
method makebuf() public static
this method is equivalent to the IBM CMS command 'MAKEBUF', which creates a new, nested Stack (with an own buffer). Consequently, each 'MAKEBUF' system command in your Rexx program is translated to RexxStk.makebuf() by the Rexx2Nrx converter.
method desbuf() public static
this method is equivalent to the IBM CMS command 'DESBUF', which destroys all pending lines in the current buffer, and resets the Stack pointers (FIFO and LIFO) to the first and last entries of the next higher Stack/Queue buffer. Consequently, each 'DESBUF' system command in your Rexx program is traslated to RexxStk.desbuf() by the Rexx2Nrx converter.