× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 2018-06-20 5:43 PM, Troy Foster wrote:
I have looked an I can't find a solution. This is example of what I am
trying to accomplish. Is it possible? Does anyone have an example?
...
P LastName B
D LastName PI 10I 0
D parm1 like(name)
D parm2 like(name)

c select
c when parm1 < parm2
c return 1
c when parm1 > parm2
c return -1
c other
c return 0
c endsl

P E


Change your LastName procedure to handle the parameters as data structures with NB and A subfields. First compare the NB values, then compare the A values.

d ds
D DS 5 dIM(10)
D NB 1s 0 OVERLAY(DS:*NEXT) INZ(0)
d A 1 OVERLAY(DS:*NEXT) INZ(' ')
add D nameDs ds 5 qualified
add D nb 1s 0
add D a 1

...
P LastName B
D LastName PI 10I 0
chg D parm1 likeds(nameDs)
chg D parm2 likeds(nameDs)

Then code the select like this:
c select
* Compare the NB values first
c when parm1.nb < parm2.nb
c return 1
c when parm1.nb > parm2.nb
c return -1
* The NB values are the same. Compare the A values next
c when parm1.a < parm2.a
c return 1
c when parm1.a > parm2.a
c return -1
* The NB values and A values are the same
c other
c return 0
c endsl


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.