Methods for use in NetRexx Pipelines Stages

These methods can be used in .nrx files for Pipeline stages.

Clicking on one of the 'Source' name buttons will display only those methods from the same source. Clicking on the 'All' button will display them from all sources.

NameReturnsMethodSource
DescriptionSignals
Comment
addpipeaddpipe(apipe=pipe)stage
Stage level addpipe
argRexxarg()stage
Get the argument(s)
arg(i=Rexx)Rexxarg(i=Rexx)stage
If it exists get value at arg[i]
arg(o=Object)Objectarg(o=Object)stage
Get the argument(s)
BuildIRangeRexxBuildIRange(a=Rexx,p=Rexx ' ')IRange
Extract contents of ranges into a string
BuildIRangeExitRexxBuildIRangeExit(r=Rexx,str=Rexx,pad=Rexx ' ')IRange
Return an expression that evaluates to the desired range
BuildIRangeStrictRexxBuildIRangeStrict(a=Rexx,p=Rexx ' ')IRange
Extract contents of ranges into a stringStageError
callpipeintcallpipe(apipe=pipe)stage
Stage level callpipeThreadQ
checkOutintcheckOut(r=int 0)stage
Check all output streams
  • rc = 12 there are no outputs streams
  • rc = 8 they are all severed
  • rc = 4 some are severed
  • rc = 0 all are OK
commitintcommit()stage
Return the return code of the pipe (so far)
commitintcommit(n=int)stage
Set the commit level of this stage to nThreadQ
counterintcounter(i=int 0)stage
increment external wait counter
DelayRingBufRexxDelayRingBuf(string = Rexx)RingBuf
Adds a Rexx string to a ring buffer
existing data is returned as a Rexx string.
DelimiterRexxDelimiter()DString
The delimiter character of the Link.,"" for no string found or "hex" or "bin" ranges.
doSetupbooleandoSetup()stage
Is the do we need to do a setup because of args?
DStringDelimited String

Delimited strings

All strings are Rexx

DString(delimitedString additional_string)

returns an object of type DString for the value of a "delimitedstring" at the begining of the input

Methods on DString:

  • String returns a Rexx string of the delimited string, without delimiters
  • Residue returns a Rexx string of the input string with the delimited string, and intermediated blanks, removed
  • Delimiter returns a Rexx string of the delimiter character or "" for no string found or "hex" or "bin".

A delimited character string is written between two occurrences of a delimiter character, as a hexadecimal literal, or as a binary literal. The delimiter cannot be blank and it must not occur within the string. Two adjacent delimiter characters represent the null string. It is suggested that a special character be used as the delimiter, but this is not enforced. However, it is advisable not to use alphanumeric characters, because a future release might add a keyword or a number as a valid option to a built-in program where only a delimited string is valid today.

A hexadecimal literal is specified by a leading H or X followed by an even number of hexadecimal digits. A binary literal is specified by a leading B followed by a string of 0 and 1; the number of binary digits must an integral multiple of eight.

The keyword STRING can be used to specify that the delimited string contains a string that is terminated by delimiter characters. This acts as a place-holder so that any nonblank character can be used as the delimiter character. Note that this use of the keyword is in addition to a keyword that is recognised by a built-in program. (Thus, "split string string xabcx")

DStringDStringDString(in_string = Rexx '')DString
Returns a DString from left of in_string
dumpdump()stage
Make it easier to dump
EmsgEmsg(n=int,s=String)stage
Issue an error, with the stage name.ThreadQ
Kills the pipe
EndCharRexxEndChar(n = Rexx null)IRange
Sets end column, returns old end column
EndColRexxEndCol()IRange
Returns end column
eofReporteofReport(a=Rexx)stage
Set eofReporting optionsStageError
a='CURRENT' | 'ALL' | 'ANY'
errorError(n=int,s=String)stage
Issue an errorStageError
Does not kill the pipe
exitexit(c=int)stage
Exit a stage severing all output streamsThreadQ
getAnycaseRexxgetAnycase(argstr = Rexx)utils
Checks first word of argstr for ANYCASE or alias, uses caseless compare.
Returns :
1 = found ANYCASE
0 = not found
-1 = found RESPECTCASE
getIRangesIRange[]getIRanges(in_string = Rexx, word_seperator = Rexx '', field_seperator = Rexx null)IRange
getKeyWordRexx[]getKeyWord(argString, keyword, minKeyLength = 0, type = 'K')utils
Search an argument string for key word and value

This searches a string for a word or its abbreviation. It is for searching argument strings for key words. A minKeyLength of '' or 0 means the full length is needed. The search is case independent. What it returns depends on the Type.

Type values (Only the first character is used):

  • Key: return boolean exists;
  • Subword: return next word;
  • Dstring: return DString
  • Qword: return QWord

It returns a Rexx Indexed string of what it found including the original string with the keyword (and Subword, Dstring, or Qword) removed. If the key word is not found the original string is returned.

A key of "" and type of "DString" will search for a Dstring at the beginning of the argString.

Note: This version, when searching for a keyword, does not respect quoted strings or delimited strings. It simply finds the first word that matches.

returns:

  • [0] 5 -- number of return strings
  • [1] the argString without the keyword & subkeyword(s)
  • [2] the subkeyword(s) value (or for type Key 1: keyword found | 0: keyword not found)
  • [3] the actual keyword found, this may be abbreviated or mixed case
  • [4] the delimiter for types Dstring and Qword
  • [5] the word number of the keyword, 0 for not found
getNameStringgetName()stage
Get the thread name
getPipeNameRexxgetPipeName()stage
getRexxRexx numbergetRexx(n=Rexx)stage
Get variable context
GetRingBufRexxGetRingBuf()RingBuf
returns a ring buffer as a Rexx string
The starting point is where new data would be inserted.
GetXorcRexxGetXorc(xorc_string)utils
Returns a Rexx character
GetXRangeRexxGetXRange(argstring)utils
Returns Rexx string of characters in the xrange
Inspects the first word of argstr. Returns a string of characters in the collating order inclusive of the first and last. (xorc can be the word BLANK.) Returns '' if first word is not a valid XRange.
   xrange:
   |--+--xorc---------+--|
      +--xorc-xorc----+
      +--xorc.number--+
gogo()stage
Start a stage selecting default input and output streamsThreadQ
inStreaminStream(inStream=int,link=link,callPipe=boolean)stage
Replace output of stage with linkStageError
inStreamNumberintinStreamNumber()stage
Current input stream
inStreamStateintinStreamState()stage
Returns:
  • -1 -- unused (autocommit)
  • 0 -- readto/peekto will not block
  • 1 -- other
  • 2 -- severed
  • 3 -- unconnected
IRangeInput Range
|--+-range--------------+------------|
   |    ⬐----------+    |
   +-(--+----range-+--)-+
   +-(strict-range-+--)-+

 range:

   ⬐------------------------------+
 |-+--+--------------------------+-+--------▶
      +-+-FIELDSEParator-+--xorc-+
        +-WORDSEParator--+

     ⬐----------------------------------+
 ▶--+--+------------------------------+-+---▶
       +-SUBSTRing--| rangePart |--OF-+

 ▶--| rangePart |----|

 rangePart:

 |--+------------+--------------▶
    +-| wrdSep |-+
    +-| fldSep |-+

 ▶--+-snumorstar------------+--------|
    +-snumorstar;snumorstar-+
    +-numorstar-numorstar---+
    +-numorstar.number---+

 wrdSep:

 |--+------------------------+--Words------|
    +-+-WORDSEParator-+-xorc-+
      +-WS------------+

 fldSep:

 |--+-------------------------+--Fields----|
    +-+-FIELDSEParator-+-xorc-+
      +-FS-------------+

Examples:

      1-*
      word 5
      1;-1
      -18;28
      field 4

An input range is specified as a column range, a word range, a field range.

A single column is specified by a signed number. Negative numbers are relative to the end of the record; thus, -1 is the last column of the record. A column range is specified as two signed numbers separated by a semicolon or as a range. When a semicolon is used, the first number specifies the beginning column and the second number specifies the ending column. When the beginning and end of a field are relative to the opposite ends of the record, the input field is treated as a null field if the ending column is left of the beginning column.

A word range is specified by the keyword WORDS, which can be abbreviated down to W. Words are separated by one or more blanks. The default blank character is X'20'. Specify the keyword WORDSEPARATOR to specify a different word separator character. WORDSEPARATOR can be abbreviated down to WORDSEP; WS is a synonym.

A field range is specified by the keyword FIELDS, which can be abbreviated down to F. Fields are separated by tabulate characters. Two adjacent tabulate characters enclose a null field. (Note the difference from words.) The default horizontal tab character is X'09'. Specify the keyword FIELDSEPARATOR to specify a different field separator character. FIELDSEPARATOR can be abbreviated down to FIELDSEP; FS is a synonym.

isFirstStagebooleanisFirstStage()stage
get if this stage is first working stage in pipe fragment. Ignores precedding COMMENT stage(s)
LengthRexxLength()IRange
Returns length of selection
Links are used for two purposes.
  1. they are pointers to a stream that can be used by called pipes to replace the connects in current streams.
  2. to save a connect when a stream is replaced by inStream or outStream.
maxInputStreamintmaxInputStream()stage
Max defined Input stream
maxOutputStreamintmaxOutputStream()stage
Max defined Output stream
mrcRexx numbermrc()stage
Get the max return code
nocommitnocommit()stage
Do not commit to -1 at first peek, readto or output
numberRexxNumber()IRange
Returns start column
object2rexxRexxobject2rexx(a=Object)utils
Convert an object to Rexx if possibleStageError
object2stringStringobject2string(a=Object)utils
Convert an object to a string if possibleStageError
outputoutput(d=Object)stage
Output data to output streamStageError
ThreadQ
Note: no StageError is raised when outputing to an unconnected stream though a StageError will occur outputing to a severed stream. After njPipes has processed the sever the severed stream is seen as unconnected. ie. you only see a sever once for a stream/connection pair.
outStreamoutStream(out_stream=int,link=link,iscallpipe=boolean)stage
Replace input of a stage with linkStageError
outStreamNumberintoutStreamNumber()stage
Current output stream
outStreamStateintoutStreamState()stage
Returns:
  • -1 -- unused (autocommit)
  • 0 -- output will not block
  • 1 -- output waiting (Multi Threaded)
  • 2 -- severed
  • 3 -- unconnected
peektoObjectpeekto()stage
Peek at input data...StageError
ThreadQ
pipStoppipStop()stage
ThreadQ
posintpos(haystack=byte[],needle=byte[])utils
PrefixRexxPrefix(n = Rexx null)IRange
Returns the string before the IRange string.
putLinkputLink(k=Rexx,o=link)stage
PutRingBufPutRingBuf(s = Rexx)RingBuf
Adds a Rexx string to a ring buffer, after the preceding data.
QWordQuoted Word

A Qword is an optionally quoted word. If it contains spaces, it must be quoted. The quote marks may be single or double.

rcRexx numberrc()stage
Get the return code
rcintrc(e=StageError)stage
Set the return code
rcintrc(n=int) stage
Set the return code
readtoObjectreadto()stage
Read data from input pnodeStageError
ThreadQ
Regex StringRegular Expresion

|--regex_string--|

Examples:

  • a
  • A dog
  • ^[Aa]?\s*dog(s)?

A regular expression string, or regex_string, defines a search pattern for strings. The search pattern can be anything from a simple character, a fixed string, or a complex expression containing special characters describing the pattern.

Using regular expressions can be very powerful. Also cn be very hard to read, and nearly so to write.

Regular expressions are used in many different programming languages, and have several dialects. NetRexx Pipelines uses its underlying Java's version.

ResidueRexxResidue(n = Rexx null)IRange
ResidueRexxResidue()DString
What is left of input string afte DString has been removed
rexxArgRexxrexxArg(a=Rexx)utils
""
Apparently deprciated and returns ''. Did return the number of Rexx object arguments.
RingBufRingBufRingBuf(i = Rexx)RingBuf
Creates an empty ring buffer of size
runrun()stage
Runable body of stage
Must be overridden by the stage. Called by system to run the stage.
Sel1IRangeRexxSel1IRange(str=Rexx,pad=Rexx)IRange
Returns the range out of string
Sel1IRangeExitRexxSel1IRangeExit(str=Rexx,pad=Rexx)IRange
Generate a command to extract one IRange element
selectAnyInputselectAnyInput()stage
Select any input stream
The most reciently referenced stream with input is selected
selectInputselectInput(stream=int)stage
Select an input streamStageError
A stage error will occur if the stream does not exist
selectOutputselectOutput(stream=int)stage
Select an output streamStageError
A stage error will occur if the stream does not exist
SelIRangeRexxSelIRange(str=Rexx,pad=Rexx ' ')IRange
Returns an IRange object for a range, including subranges, out of string
SeparatorRexxSeparator(n = Rexx null)IRange
setArgsetArg(a=Rexx,d=boolean 0)stage
Set the arguments(s)
setArgsetArg(o=Object,d=boolean 0)stage
Set the arguments(s)
setDebugsetDebug(level=int)stage
setNamesetName(name=String)stage
Set the thread name
setRelPrioritysetRelPriority(n=int)stage
Set Relative Priority by adding n.
setRunawaysetRunaway(i=int)stage
Set stall time
severCallbackseverCallback(type=boolean,stream=int)stage
Callback to be overridden by threaded stages needing to interrupt blocked threadsStageError
severInputseverInput()stage
Sever an input stream passing EndOfData to output pnodeStageError
The sever is indicated by seting inn.outs to null, this causes output to get an exception. The inn.ins.inn is also set to null to trigger readto/peekto/selectanyinput for eofreport options. We have to be carefull not to restore inn to easily so the sever is not missed...
severOutputseverOutput()stage
StageError
Once the sever is processed by the reciever the sin or sout variable is set to -99 to allow selectinput/output
shortStreamsshortStreams()stage
Short the current input and outputStageError
ThreadQ
The pnode for the input stream is bypassed and the stages current streams are unlinked. If the stream lists are empty a stageError is raised to end the stage.
sortInsertIntoRexx[]sortInsertInto(list = Rexx, new = Rexx, strict = Rexx 0)utils
Insert a new item into a sorted list in a Rexx indexed variable. Returns the list with new inserted.
Indexed by integers from 1.
Index 0 is a count of the other values.
If strict = 1 or the first charater is 'S' or 's', then strict compare, <<, is used,
otherwise normal compare, <, is used.
   Example:

    mylist = Rexx '' -- new empty list
    mylist[0] = 0  -- number of items in the list

    sortInsertInto(mylist, 'first')     -- into empty list
    sortInsertInto(mylist, 'early')     -- before anything in the list
    sortInsertInto(mylist, 'last')      -- after everyting in the list
    sortInsertInto(mylist, 'inserted')  -- somewhere in the middle of the list, the typical case

    loop i = 0 to list[0]
      say i ':' list[i]
    end

0 : 4
1 : early
2 : first
3 : inserted
4 : last
StageErrorStageError(r=int,s=String)stage
stageExitbooleanstageExit(pInfo=Rexx,code=Rexx)utils
Change the unprocessed pipe definition, the definition of the current stageStageError
Called by the compiler.
StartCharRexxStartChar(n = Rexx null)IRange
Sets start column, returns old start column
StartColRexxStartCol()IRange
Returns start column
StrictbooleanStrict()IRange
StringRexxString()DString
String found from delimited string
SubIRangeIRangeSubIRange(n = IRange null, d = 1)IRange
suspendsuspend()stage
Let all the other stages go before we start againThreadQ
toRexxRexxtoRexx()IRange
Returns readable data about an IRange
toStringStringtoString()IRange
Returns readable data about an IRange
TypeRexxType()IRange
XorCHex number or Character
  • A character specified as itself (a one-character word) or its
  • hexadecimal representation (a two-character word). The blank is
  • represented by the keyword BLANK, which has the synonym SPACE, or with
  • its hex value, X'40'. The default horizontal tabulate character (X'05')
  • is represented by the keyword TABULATE, which can be abbreviated down to TAB.
XrangerxRexxxrangerx(fc='',lc='')utils
Just like classic Rexx BIF xrange(). Returns a string of characters in the collating order inclusive of the first and last. Wraps around 0xFF to 0x00 if needed.