× 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.



Thanks I will.

On 6/20/2018 4:53 PM, Alan Campin wrote:

If you look at [1]www.think400.dk/downloads.htm you will find a project under
my name called *XVSRTQ - Dynamic sort of data*.

I solved the problem by using two complement. There might be other
solutions.

On Wed, Jun 20, 2018 at 2:43 PM Troy Foster [2]<tfoster@xxxxxxxxxx> 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?

I get this when it sorts.
NB(1) = 5.
NB(2) = 2.
NB(3) = 0.
NB(4) = -6.
NB(5) = -4.
NB(6) = -3.
NB(7) = 0.
NB(8) = 0.
NB(9) = 0.
NB(10) = 0.

I want to get:

NB(1) = 5.
NB(2) = 2.
NB(3) = 0.
NB(4) = -3.
NB(5) = -4.
NB(6) = -6.
NB(7) = 0.
NB(8) = 0.
NB(9) = 0.
NB(10) = 0.

This is a sample of the code that I use. I

H BNDDIR('QC2LE')

D qsort PR ExtProc('qsort')
D base * value
D num 10U 0 value
D width 10U 0 value
D compare * procptr value

D LastName PR 10I 0
D parm1 like(name)
D parm2 like(name)

D name s 5
D num_names s 10i 0

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

c eval NB(1) = -6
c eval NB(2) = -3
c eval NB(3) = 5
c eval NB(4) = -4
c eval NB(5) = 2
c eval NB(6) = 0
c Eval A(1) = 'A'
c Eval A(2) = 'Y'
c Eval A(3) = 'G'
c Eval A(4) = 'H'
c Eval A(5) = 'D'
c Eval A(6) = 'B'

c eval num_names = 6

c callp qsort(%addr(NB): num_names:
c %size(name): %paddr('LASTNAME'))
c eval *inlr = *on

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
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: [3]RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [4]https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [5]RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [6]https://archive.midrange.com/rpg400-l.

Please contact [7]support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: [8]http://amzn.to/2dEadiD

References

Visible links
1. http://www.think400.dk/downloads.htm
2. mailto:tfoster@xxxxxxxxxx
3. mailto:RPG400-L@xxxxxxxxxxxx
4. https://lists.midrange.com/mailman/listinfo/rpg400-l
5. mailto:RPG400-L-request@xxxxxxxxxxxx
6. https://archive.midrange.com/rpg400-l
7. mailto:support@xxxxxxxxxxxx
8. http://amzn.to/2dEadiD

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.