Skip to content
REXX & automation

PARSE

REXX's instruction for pulling a string apart into pieces, by position, by delimiter or by pattern.

Also written PARSE VAR, PARSE ARG

PARSE is the instruction that makes REXX so effective at handling text, and it is the feature people miss most in other languages.

Instead of writing code to search and slice a string, you describe the shape you expect and name the parts. Splitting a line into fields separated by spaces is one instruction with a list of variable names. Splitting on a particular character means putting that character in the template. Taking fixed columns means giving positions.

Its variants cover where the text comes from. Parsing the argument handles what was passed to the exec. Parsing a variable takes apart something already in hand. Parsing the value of an expression works on a result directly. There is also a form that reads a line typed by the user.

Because so much mainframe work involves reading command output, listings and records with fixed layouts, this comes up constantly. An exec that runs a command, parses the output and acts on what it found is the shape of a great deal of practical automation.

Browse all 115 terms

Learn this properly.

Use PARSE for real in Mainframe101, in your browser, with Zed beside you. Join the waitlist.

Early access and updates. No spam, unsubscribe any time.