Unstring is a great option. Since each field is bounded by a vertical stripe, this is a natural correspondence.
If you have a fixed number of fields, you can do it all at once. If you have a variable number of fields, you can use the "pointer" option for a step-by-step field by field, until you reach the end.
For instance:
Move +1 to my-ptr
Move input-record to remaining-str
Perform until remaining-str = spaces
Unstring remaining-str
delimited by '|'
into
next-field
remaining-str
pointer my-ptr
End-Unstring
... do something with next-field ...
End-Perform
source
share