Title: Message
a proggie is the easiest (as not got finickety run params, no 'maybe wont works, etc), and way, way quicker!
max.n = 500                                                            ; * set to the max no of possible 'N' s
dim N(max.n) ; mat N = ''                                          ; * storage area for highest X encountered thus far
list      = ''                                                                ; * variable to build list into
open 'ACTUAL.FILE" to Afile then                              ; * whatever file you're processing
     select Afile                                                         ; * doesn't require a presort of the file
         readnext key else exit
         prefix = field(key,'.',1)
         suffix = field(key,'.',2)
         if suffix > N(prefix) then N(prefix) = suffix           ; * keep only the highest X per N
     for x = 1 to max.n                                               ; * once file processed, build a list
         list := x : '.' : N(x) : @fm
     next x
     list[-1,1] = ''                                                        ; * remove the final field mark
     formlist list                                                         ; * activate the list
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anthony Youngman
Sent: 04 February 2004 01:08
To: U2 Users Discussion List
Subject: RE: Help wanted creating an efficient SELECT statement

This is a bit messy ...
Firstly create an i-descriptor as follows
0002: FIELD( @ID, ",", 1, 1); FIELD( @ID, ",", 2, 1)+1; TRANS( @FILENAME, @1:".":@2, 0, "X")
(I think I've got that right...)
What it's doing is adding 1 to the X bit, and doing a trans to see if the record exists. If I've got it right, this i-descriptor should return the next id if it exists, and null if it doesn't. So just select with this thing equal to null. Of course, it'll be fooled if you have a non-sequential X list.

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marco Manyevere
Sent: 04 February 2004 08:20
Subject: Help wanted creating an efficient SELECT statement

Hi All,
I have a file with IDs like this:
1.2, 1.2 1.3, 2.1, 2.2, 2.3, 2.4, 3.1, 4.1, 5.1, 5.2, ...
Each ID is N.X where X is a numeric secondary ID number from 1 going upwards and N is the primary ID number which may or may not be numeric. Different primary IDs have a different number of secondary IDs.
For a certain report, I want to select only the records with the highest numerical value of X for each of N. For the above example, I want to end up with 1.3, 2.4, 3.1, 4.1, 5.2, Can a SELECT statement(s) be composed without having to write a program? If not what would be the best approach.
Thanks for any help.

BT Yahoo! Broadband - Free modem offer, sign up online today and save 80


This transmission is intended for the named recipient only. It may contain private and confidential information. If this has come to you in error you must not act on anything disclosed in it, nor must you copy it, modify it, disseminate it in any way, or show it to anyone. Please e-mail the sender to inform us of the transmission error or telephone ECA International immediately and delete the e-mail from your information system.

Telephone numbers for ECA International offices are: Sydney +61 (0)2 9911 7799, Hong Kong + 852 2121 2388, London +44 (0)20 7351 5000 and New York +1 212 582 2333.

u2-users mailing list

Reply via email to