dbTalk Databases Forums  

Unidata Locate with no sort

comp.databases.pick comp.databases.pick


Discuss Unidata Locate with no sort in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
panzerboy@gmail.com
 
Posts: n/a

Default Unidata Locate with no sort - 04-03-2006 , 10:52 PM






I just caused a foulup in D3 using the LOCATE( function.
I'm used to UniData & I thought that if ...

POS=0
LOCATE(X,Y,1;POS)

would leave POS as zero if the locate of X in Y<1> failed.
But no D3 & Universe set the POS to the next available mv position.
Have I lost it?
I dont have a Unidata machine to confirm my shaky recollections.

Jeremy Thomson


Reply With Quote
  #2  
Old   
Mark Brown
 
Posts: n/a

Default Re: Unidata Locate with no sort - 04-04-2006 , 01:33 AM






On D3, POS is set the where the item is, or where it should be if it's not
there.

Locate with 'AR', 'AL' etc will position POS where the item would be
inserted if it doesn't exist. Without the sorting options, POS would be set
to 1+item count.

Use the THEN/ELSE to determine if it passed or failed.


<panzerboy (AT) gmail (DOT) com> wrote

Quote:
I just caused a foulup in D3 using the LOCATE( function.
I'm used to UniData & I thought that if ...

POS=0
LOCATE(X,Y,1;POS)

would leave POS as zero if the locate of X in Y<1> failed.
But no D3 & Universe set the POS to the next available mv position.
Have I lost it?
I dont have a Unidata machine to confirm my shaky recollections.

Jeremy Thomson




Reply With Quote
  #3  
Old   
Peter McMurray
 
Posts: n/a

Default Re: Unidata Locate with no sort - 04-04-2006 , 03:51 AM



Hi
I am not sure if it is documented (note to self must check) but ARS was
added to D3 some years ago which gets around the problem of negatives being
sorted in with the positives based on unsigned status.
By the way I'm sorry mate it is 10 years since I used Unidata but none of my
programs fell over and I have always seen POS as returning the calculated
position even if it was not there. Personally I use the ELSE clause plus
POS to shove it in. I must admit I stick to the original Reality format.
Peter McMurray

"Mark Brown" <mbrown (AT) drexelmgt (DOT) com> wrote

Quote:
On D3, POS is set the where the item is, or where it should be if it's not
there.

Locate with 'AR', 'AL' etc will position POS where the item would be
inserted if it doesn't exist. Without the sorting options, POS would be
set to 1+item count.

Use the THEN/ELSE to determine if it passed or failed.


panzerboy (AT) gmail (DOT) com> wrote in message
news:1144122769.240205.293550 (AT) u72g2000cwu (DOT) googlegroups.com...
I just caused a foulup in D3 using the LOCATE( function.
I'm used to UniData & I thought that if ...

POS=0
LOCATE(X,Y,1;POS)

would leave POS as zero if the locate of X in Y<1> failed.
But no D3 & Universe set the POS to the next available mv position.
Have I lost it?
I dont have a Unidata machine to confirm my shaky recollections.

Jeremy Thomson






Reply With Quote
  #4  
Old   
Cliff
 
Posts: n/a

Default Re: Unidata Locate with no sort - 04-05-2006 , 07:00 PM



I have always found having the POS variable filled with the expected
position very useful. This allows you to use the ELSE clause and then
use the INSERT statement to insert the substring into the searched
string.

Cliff


Reply With Quote
  #5  
Old   
Bill H
 
Posts: n/a

Default Re: Unidata Locate with no sort - 04-06-2006 , 03:13 PM



Jeremy:

According to the UniData manual:

SETTING location
Returns the location of the string. If the search is not successful,
execution depends on the presence of the BY clause:

If the BY clause is included, the array is assumed to be sorted, and a
location is returned indicating where the element should be inserted to
maintain the array in sorted order.

If the BY clause is not included, the array is assumed to be unsorted,
and the location returned is of the last element plus one.



Hope this helps.

Bill

<panzerboy (AT) gmail (DOT) com> wrote

Quote:
I just caused a foulup in D3 using the LOCATE( function.
I'm used to UniData & I thought that if ...

POS=0
LOCATE(X,Y,1;POS)

would leave POS as zero if the locate of X in Y<1> failed.
But no D3 & Universe set the POS to the next available mv position.
Have I lost it?
I dont have a Unidata machine to confirm my shaky recollections.

Jeremy Thomson




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.