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




Hi Brain:

Could you let me know any thought process reg below one :

This is related to : Primay(Py) & Secondary(Sy) file.
 
1.Having a program @ my end which is using One Py & Two Sy file , where
RPG logic cycle in place.
 
2.I am trying to get the last record value from one of the Sy file
before the control comes out of the program.
 
3. Tried almost all the possibilities but could not do it.
 
Question is - Is that possible to check the ind like RT (or) Is there
any way to trap the last record may be in O spec ?
 

Regs,
Barath

-----Original Message-----
From: rpg400-l-bounces+barath.ramalingam=wipro.com@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+barath.ramalingam=wipro.com@xxxxxxxxxxxx] On
Behalf Of Brian Lewis
Sent: Thursday, February 15, 2007 3:16 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Sorting an array on multiple keys using SORTA

On Thu, 15 Feb 2007 12:43:40 +0530
ewart.desouza@xxxxxxxxxxx wrote:

I would like to sort the following array on the first 7 fields i.e.
from WWBCD through WATNNB. Is it possible using SORTA ???  According 
to the manual you can sort only one field at a time.

It'd be nice to do a radix sort. A radix sort is a kind of super sort
that makes multiple passes. You'd make seven passes. The first sort
would be on the least significant field. The second would be on the next
most significant field, and so on. The last sort would be on the most
significant field.

You can kind of see it work in a miniature example. The leftmost column
is the input. I sort them by the ones column, then by the tens column,
then by the hundreds column.

329    651    329    329
757 -> 757 -> 651 -> 651
651    329    757    757

The one trick is that the sort you use to do a radix sort must be
"stable", meaning that if the compared fields are equal, they should
come out in the same order that they went in.

I think I see in the SORTA documentation that it isn't stable. That's
sad, because it would have been really nice.

Here are some stable sorts you could implement, if you choose to do it
the radix way: http://en.wikipedia.org/wiki/Category:Stable_sorts

I guess you could also use qsort to do it. It would just have kind of a
nasty comparison function. The comparison function would start by
comparing the most significant fields. If they were unequal, you could
return your decision. If they were equal, you'd have to check the next
most significant field, and so on.

--
Brian Lewis
http://www.i5sec.com/

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.



The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.
 
www.wipro.com


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.