|
Hi Charles, > In other words, I was thinking gettok() would be called once and every > element of tokens would be assigned the same value. But what you're saying > is that gettok() gets called multiple times, once for every element. Yep, that's what I'm saying. That's not the only place where the distinction is important, either. For example, how many times will gettok() be called in this code: if gettok( foo : '|' : pos ) = 'custno' or gettok( foo : '|' : pos ) = 'test'; endif; The answer is, "it depends." If the first token is 'custno' it's called twice. If not, it's called once. Or the opposite: if gettok( foo : '|' : pos ) = 'a' and gettok( foo : '|' : pos ) = 'b' and gettok( foo : '|' : pos ) = 'c' and gettok( foo : '|' : pos ) = 'd'; endif; If foo contains "a|d|c|b", gettok() is called twice. If it contains "|b|c|d" it is called once. If it contains "a|b|c|e" it's called 4 times... It's important to understand how expressions work in ILE RPG. Fortunately, they work the same way as they do in C, C++, Java, etc. Once you've learned one of them, the others all fall into place. :)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.