Thread View: bit.listserv.tsorexx
1 messages
1 total messages
Started by John McKown
Sun, 28 Apr 2013 19:56
better parsing algorithm?
Author: John McKown
Date: Sun, 28 Apr 2013 19:56
Date: Sun, 28 Apr 2013 19:56
40 lines
2920 bytes
2920 bytes
I need to process some data which is generated on UNIX. The data is
in tab separated format. That is, each element is separated by a tab
(x'05' in EBCDIC). What I'm doing is similar to:
tab='05'x
/* assume data is in non-stem variable data */
/* I will put each value in data.n where n starts at 1 */
data.0=0
i=0
do while length(data) > 0
i=i+1
parse var data value (tab) data
data.i=value
data.0=i
end
OK, I can tighten it up a bit by using "data.i" in the parse instead of the
temporary variable "value". And I don't need to assign i to data.0 on
each iteration; I could do it after the "end" of the loop. But I do this just
in case a less knowledgeable person needs to modify the code. I,
personally, consider it easier to understand this way. But I could be
wrong, of course.
What I am hoping for is a "better" or "more understandable" algorithm.
No, I can't
translate the tabs to blanks, or likely do any other type of
translate. The values
may legitimately have blanks as part of the value. Or even other
characters except for tabs.
--
This is a test of the Emergency Broadcast System. If this had been an
actual emergency, do you really think we'd stick around to tell you?
Maranatha! <><
John McKown
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LISTSERV@VM.MARIST.EDU with the message: INFO TSO-REXX
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads