Occasionally the readability of a Rexx instruction is improved when the instruction is continued on multiple source lines. There are two ways to continue Rexx instructions.
Ending the line with a comma
Ending the line with an incomplete remark
Rexx instructions are continued when the last significant character of the source line is a comma. When the only characters that follow the comma are spaces or comments, then the source line is continued.
Here is an example of a lengthy parse instruction, that spans multiple source lines. In this example, the input request is a string value, with fields separated by tab characters. Each source line that follows the parse instruction obtains one tab-delimited field. Each of these lines, except the last line, ends with a comma.
tab = '09'x
parse var request ,
Company (tab) ,
Sales (tab) ,
CostOfGoods (tab) ,
NetIncome (tab) ,
Cash (tab) ,
AccountsReceivable (tab) ,
AccountsReceivablePrior (tab) ,
Inventory (tab) ,
InventoryPrior (tab) ,
OtherCurrentAssets (tab) ,
PropertyEquipment (tab) ,
AccumulatedDepreciation (tab) ,
OtherAssets (tab) ,
TotalAssetsPrior (tab) ,
CurrentLiabilities (tab) ,
LongTermDebt (tab) ,
OtherLiabilities (tab) ,
PreferredStock (tab) ,
CommonStock (tab) ,
RetainedEarnings (tab) ,
StockholdersEquity (tab) ,
StockValue (tab) ,
SharesOutstanding (tab) ,
Rexx instructions are also continued when the line ends in the middle of a remark.
Here is an example of an instruction that is continued with a remark.
say 'Everything should be made as simple as possible' /* and the quote
continues... */ || ', but not simpler.' /* a remark attributed to Albert Einstein */
Everything should be made as simple as possible, but not simpler.
When a source line contains multiple terms that are separated by a continuation request, the values are typically concatenated with an intervening space.
say 'abra' ,
abra ca dabra
Often, you will want to concatenate the values without an intervening space. This is accomplished by adding an abuttal operator, at the front of the lines which follow the first.
say 'abra' ,
|| 'ca' ,
Commas are used as argument separators in function calls. When a function call spans multiple source lines, usually you will split the line at a specific argument position. In this case, the line must conclude with two commas. The first is an argument separator, and the second is a line continuation request.
call lineout file1 , , center( 'go now and do right' , , 79 ) )
is equivalent to:
call lineout file1 , center( 'go now and do right' , 79 ) )
Commas are also used in the templates of ARG and PARSE ARG instructions. In these instructions, the comma indicates that processing of the current procedure argument string is complete, and to proceed with the next argument string. It is tempting to split the template at the commas. However, you must conclude the source line with two commas in this case. The first comma is a template character, the second is a line continuation request. Here is an example of the splitting of a template that processes arguments.
parse arg argument_1 , ,