[U2] Fwd: Re: Select from one file with save-list from another file

2013-08-28 Thread Bill Haskett

Tony:

I use a simple program, inspired by a U2 tech note at 
, 
that does the following:


LSELECT ARTVIOLATION WITH UNITID IN DEFAULT.LIST.NAME

The list is simply generated then used in the statement.  So, I can 
create a select list of unit#s from anywhere and name it 
"DEFAULT.LIST.NAME".  Then can search the ARTVIOLATION file items whose 
unit ID is anywhere in the select list.


[...added comments...]
This becomes required when one does something like:

SELECT SOMEFILE 'a''b''c'...'{n}'

...and the number of items to select exceed 256 (UD barfs on this).  
Now, I just change the code to do a select first, like:


SELECT SOMEFILE 'a''b''c'...'{n}'
SAVE.LIST MY.LIST
LSELECT ANOTHERFILE WITH KEY IN MY.LIST

This turned out to be a simple solution when web'izing our application, 
knowing users will be selecting keys (not values) to submit to a select 
statement that does something (lots of things, actually).  :-)


Bill
Untitled Page



- Original Message -
*From:* 3xk547...@sneakemail.com
*To:* u2-users@listserver.u2ug.org
*Date:* 8/28/2013 5:18 AM
*Subject:* Re: [U2] Select from one file with save-list from another file

Not sure where to toss this into this thread so I'll start at the
beginning. I wanted to see the solutions that would be offered. I
blogged on exactly this topic back in 2008. The solution I published
for D3 uses @environment variables to allow us to do inner queries
with a tiny bit of simple and reusable code, no dict items, no work
files, and no save-lists. Perhaps someone can describe the
UD/UV-specific equivalents so that we can accomplish this here using
similar methods? I'll be happy to add the U2 solution to the blog for
future reference.
http://Nebula-RnD.com/blog/tech/mv/2008/03/d3shell1.html



Tony Gravagno   
Nebula Research and Development 
TG@ remove.pleaseNebula-RnD.com 
http://Nebula-RnD.com/blog  
http://LinkedIn.com/in/TonyGravagno 
http://Twitter.com/TonyGravagno 
http://PickWiki.com 
http://groups.google.com/group/MVDBMS   
http://www.LinkedIn.com/groups/Pick-Users-Group-64935   
http://BitBucket.org/FOSS4MV/



From: Hilk, Brandon
UniVerse 10.1, HP/UX, Pick.
Is there a way I can build a save-list from a selection from onefile
X.INFO (where the record ID is an 8 digit number) and use that listto
select from file Y.INFO (where that 8 digit number is not the recordID
but does exist as a "foreign key" elsewhere in the file). In SQLthis
would be considered a join and would look something like this:

select *
from X.INFO, Y.INFO
where X.INFO.packet.id=Y.INFO.packet.id
and X.INFO.status='ccc';

I can run this in TCL and have it return the results I want butcan't build
a save-list from it because I don't know the UniVerse/SQL syntax todoso.
So to summarize, is there a way to use a save-list built from X.INFOto
make another save-list comprised of the record ID's from Y.INFO?



___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Manu Fernandes
hi,

like the same post from a few month, use direct access to btree indexfile (type 
25) you can do it like this :

1) add a index on Y.INFO:PACKET.ID (create.index + build.index)

2) set a VOC entry to the btree file I_Y.INFO/INDEX.000 (000 can be different)

ED VOC YINFO.PACKETID
001 F
002 I_Y.INFO/INDEX.000
003 D_VOC

3) do your select on X.INFO + SAVING PACKET.ID . in memory you have PACKETID 
list



4) retrieve Y.INFO id's via btree direct access ; in memory you get Y.INFO id's 
using QSELECT on Y.INFO

sample:


SELECT X.INFO WITH DOB <  SAVING {UNIQUE} PACKET.ID
QSELECT YINFO.PACKETID


i hope this help
Manu

"Hilk, Brandon"  a écrit :

Thanks everyone, I've got some usable info to work with. Sorry if my
original post was a bit vague, let me illustrate to clarify:


X.INFO
@PACKET.ID.NAME..DOB...STATUS

52781456.52781456..DOE, JOHN.06-17-1985CCC


Y.INFO
@BILL.DAY..BILL.AMT..TYPE..PACKET.ID

52781456*MPA*2...08/28/201350MPA...52781456


Hopefully showing a rough table structure helps me better convey what I
was trying to do. Using criteria in X.INFO to create a selection list
and then using that list to select and export information from Y.INFO
like BILL.DAY and BILL.AMT that wasn't available in X.INFO. Since a
select list made from X.INFO would have different record ID's, it
wouldn't be able to be used to select from Y.INFO. Hence, me looking for
some trickery to use Y.INFO's PACKET.ID field as the array for the
select list to work against.

Brandon

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org]

On 8/27/2013 1:24 PM, Hilk, Brandon wrote:
> Hello!
>
>
>
> UniVerse 10.1, HP/UX, Pick.
>
>
>
> Is there a way I can build a save-list from a selection from one file
> X.INFO (where the record ID is an 8 digit number) and use that list to
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL this
> would be considered a join and would look something like this:
>
>
>
> select *
>
> from X.INFO, Y.INFO
>
> where X.INFO.packet.id=Y.INFO.packet.id
>
> and X.INFO.status='ccc';
>
>
>
> I can run this in TCL and have it return the results I want but can't
> build a save-list from it because I don't know the UniVerse/SQL syntax
> to do so.
>
>
>
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?
>
>
>
> Thanks for any advice you can give.
>
>
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Wjhonson
What message do you get, when you try to create new Dict entries?
 

 

 

-Original Message-
From: Hilk, Brandon 
To: U2 Users List 
Sent: Wed, Aug 28, 2013 9:06 am
Subject: Re: [U2] Select from one file with save-list from another file


Not myself, no. I could get with the programming staff and ask them to
create fields in X.INFO that have the Y.INFO values that I need, but
seems like a cop-out :) They are a grumpy bunch and if I have the
ability to bypass them by writing a convoluted series of select
statements then that would be my preferred route of action :) If there's
no way to do it without programmer intervention then so be it.
Thanks

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Wednesday, August 28, 2013 10:51 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Select from one file with save-list from another file

Do you have the ability to create new DICT entries in both X.INFO and
Y.INFO ?


 

 

 

-Original Message-
From: Hilk, Brandon 
To: U2 Users List 
Sent: Wed, Aug 28, 2013 8:09 am
Subject: Re: [U2] Select from one file with save-list from another file


Thanks everyone, I've got some usable info to work with. Sorry if my
original post was a bit vague, let me illustrate to clarify:


X.INFO
@PACKET.ID.NAME..DOB...STATUS

52781456.52781456..DOE, JOHN.06-17-1985CCC


Y.INFO
@BILL.DAY..BILL.AMT..TYPE..PACKET.ID

52781456*MPA*2...08/28/201350MPA...52781456


Hopefully showing a rough table structure helps me better convey what I
was trying to do. Using criteria in X.INFO to create a selection list
and then using that list to select and export information from Y.INFO
like BILL.DAY and BILL.AMT that wasn't available in X.INFO. Since a
select list made from X.INFO would have different record ID's, it
wouldn't be able to be used to select from Y.INFO. Hence, me looking for
some trickery to use Y.INFO's PACKET.ID field as the array for the
select list to work against.

Brandon

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] 

On 8/27/2013 1:24 PM, Hilk, Brandon wrote:
> Hello!
>
>   
>
> UniVerse 10.1, HP/UX, Pick.
>
>   
>
> Is there a way I can build a save-list from a selection from one file
> X.INFO (where the record ID is an 8 digit number) and use that list to
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL this
> would be considered a join and would look something like this:
>
>   
>
> select *
>
> from X.INFO, Y.INFO
>
> where X.INFO.packet.id=Y.INFO.packet.id
>
> and X.INFO.status='ccc';
>
>   
>
> I can run this in TCL and have it return the results I want but can't
> build a save-list from it because I don't know the UniVerse/SQL syntax
> to do so.
>
>   
>
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?
>
>   
>
> Thanks for any advice you can give.
>
>   
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Hilk, Brandon
Not myself, no. I could get with the programming staff and ask them to
create fields in X.INFO that have the Y.INFO values that I need, but
seems like a cop-out :) They are a grumpy bunch and if I have the
ability to bypass them by writing a convoluted series of select
statements then that would be my preferred route of action :) If there's
no way to do it without programmer intervention then so be it.
Thanks

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Wjhonson
Sent: Wednesday, August 28, 2013 10:51 AM
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Select from one file with save-list from another file

Do you have the ability to create new DICT entries in both X.INFO and
Y.INFO ?


 

 

 

-Original Message-
From: Hilk, Brandon 
To: U2 Users List 
Sent: Wed, Aug 28, 2013 8:09 am
Subject: Re: [U2] Select from one file with save-list from another file


Thanks everyone, I've got some usable info to work with. Sorry if my
original post was a bit vague, let me illustrate to clarify:


X.INFO
@PACKET.ID.NAME..DOB...STATUS

52781456.52781456..DOE, JOHN.06-17-1985CCC


Y.INFO
@BILL.DAY..BILL.AMT..TYPE..PACKET.ID

52781456*MPA*2...08/28/201350MPA...52781456


Hopefully showing a rough table structure helps me better convey what I
was trying to do. Using criteria in X.INFO to create a selection list
and then using that list to select and export information from Y.INFO
like BILL.DAY and BILL.AMT that wasn't available in X.INFO. Since a
select list made from X.INFO would have different record ID's, it
wouldn't be able to be used to select from Y.INFO. Hence, me looking for
some trickery to use Y.INFO's PACKET.ID field as the array for the
select list to work against.

Brandon

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] 

On 8/27/2013 1:24 PM, Hilk, Brandon wrote:
> Hello!
>
>   
>
> UniVerse 10.1, HP/UX, Pick.
>
>   
>
> Is there a way I can build a save-list from a selection from one file
> X.INFO (where the record ID is an 8 digit number) and use that list to
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL this
> would be considered a join and would look something like this:
>
>   
>
> select *
>
> from X.INFO, Y.INFO
>
> where X.INFO.packet.id=Y.INFO.packet.id
>
> and X.INFO.status='ccc';
>
>   
>
> I can run this in TCL and have it return the results I want but can't
> build a save-list from it because I don't know the UniVerse/SQL syntax
> to do so.
>
>   
>
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?
>
>   
>
> Thanks for any advice you can give.
>
>   
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread McGowan, Ian
Create new T)ranslate ATB's in Y.INFO to lookup the data in X.INFO, and just do 
the query directly from Y.INFO?  One thing that's common in this situation is 
to have an xref file where the key is PACKET.ID and attribute 1 is a 
multivalued list of keys for Y.INFO.  If this is a packaged app, you may not 
have that luxury though ;-)

E.g. in Y.INFO,
:AE DICT Y.INFO X.STATUS
I
OCONV(PACKET.ID,"TX.INFO;X;19;19") -- use the right field position of course

:AE DICT Y.INFO X.DOB
I
OCONV(PACKET.INFO,"X.INFO;X;22;22")

:SORT Y.INFO WITH X.STATUS = "ccc" BILL.DAY BILL.AMT X.DOB

Etc.?


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Hilk, Brandon
Sent: Wednesday, August 28, 2013 8:07 AM
To: U2 Users List
Subject: Re: [U2] Select from one file with save-list from another file

Thanks everyone, I've got some usable info to work with. Sorry if my original 
post was a bit vague, let me illustrate to clarify:


X.INFO
@PACKET.ID.NAME..DOB...STATUS

52781456.52781456..DOE, JOHN.06-17-1985CCC


Y.INFO
@BILL.DAY..BILL.AMT..TYPE..PACKET.ID

52781456*MPA*2...08/28/201350MPA...52781456


Hopefully showing a rough table structure helps me better convey what I was 
trying to do. Using criteria in X.INFO to create a selection list and then 
using that list to select and export information from Y.INFO like BILL.DAY and 
BILL.AMT that wasn't available in X.INFO. Since a select list made from X.INFO 
would have different record ID's, it wouldn't be able to be used to select from 
Y.INFO. Hence, me looking for some trickery to use Y.INFO's PACKET.ID field as 
the array for the select list to work against.

Brandon

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] 

On 8/27/2013 1:24 PM, Hilk, Brandon wrote:
> Hello!
>
>   
>
> UniVerse 10.1, HP/UX, Pick.
>
>   
>
> Is there a way I can build a save-list from a selection from one file 
> X.INFO (where the record ID is an 8 digit number) and use that list to 
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL this 
> would be considered a join and would look something like this:
>
>   
>
> select *
>
> from X.INFO, Y.INFO
>
> where X.INFO.packet.id=Y.INFO.packet.id
>
> and X.INFO.status='ccc';
>
>   
>
> I can run this in TCL and have it return the results I want but can't 
> build a save-list from it because I don't know the UniVerse/SQL syntax 
> to do so.
>
>   
>
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?
>
>   
>
> Thanks for any advice you can give.
>
>   
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
-
IMPORTANT NOTICE:   This message is intended only for the addressee
and may contain confidential, privileged information.  If you are
not the intended recipient, you may not use, copy or disclose any
information contained in the message.  If you have received this
message in error, please notify the sender by reply e-mail and
delete the message.
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Wjhonson
Do you have the ability to create new DICT entries in both X.INFO and Y.INFO ?


 

 

 

-Original Message-
From: Hilk, Brandon 
To: U2 Users List 
Sent: Wed, Aug 28, 2013 8:09 am
Subject: Re: [U2] Select from one file with save-list from another file


Thanks everyone, I've got some usable info to work with. Sorry if my
original post was a bit vague, let me illustrate to clarify:


X.INFO
@PACKET.ID.NAME..DOB...STATUS

52781456.52781456..DOE, JOHN.06-17-1985CCC


Y.INFO
@BILL.DAY..BILL.AMT..TYPE..PACKET.ID

52781456*MPA*2...08/28/201350MPA...52781456


Hopefully showing a rough table structure helps me better convey what I
was trying to do. Using criteria in X.INFO to create a selection list
and then using that list to select and export information from Y.INFO
like BILL.DAY and BILL.AMT that wasn't available in X.INFO. Since a
select list made from X.INFO would have different record ID's, it
wouldn't be able to be used to select from Y.INFO. Hence, me looking for
some trickery to use Y.INFO's PACKET.ID field as the array for the
select list to work against.

Brandon

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] 

On 8/27/2013 1:24 PM, Hilk, Brandon wrote:
> Hello!
>
>   
>
> UniVerse 10.1, HP/UX, Pick.
>
>   
>
> Is there a way I can build a save-list from a selection from one file
> X.INFO (where the record ID is an 8 digit number) and use that list to
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL this
> would be considered a join and would look something like this:
>
>   
>
> select *
>
> from X.INFO, Y.INFO
>
> where X.INFO.packet.id=Y.INFO.packet.id
>
> and X.INFO.status='ccc';
>
>   
>
> I can run this in TCL and have it return the results I want but can't
> build a save-list from it because I don't know the UniVerse/SQL syntax
> to do so.
>
>   
>
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?
>
>   
>
> Thanks for any advice you can give.
>
>   
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

 
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Hilk, Brandon
Thanks everyone, I've got some usable info to work with. Sorry if my
original post was a bit vague, let me illustrate to clarify:


X.INFO
@PACKET.ID.NAME..DOB...STATUS

52781456.52781456..DOE, JOHN.06-17-1985CCC


Y.INFO
@BILL.DAY..BILL.AMT..TYPE..PACKET.ID

52781456*MPA*2...08/28/201350MPA...52781456


Hopefully showing a rough table structure helps me better convey what I
was trying to do. Using criteria in X.INFO to create a selection list
and then using that list to select and export information from Y.INFO
like BILL.DAY and BILL.AMT that wasn't available in X.INFO. Since a
select list made from X.INFO would have different record ID's, it
wouldn't be able to be used to select from Y.INFO. Hence, me looking for
some trickery to use Y.INFO's PACKET.ID field as the array for the
select list to work against.

Brandon

-Original Message-
From: u2-users-boun...@listserver.u2ug.org
[mailto:u2-users-boun...@listserver.u2ug.org] 

On 8/27/2013 1:24 PM, Hilk, Brandon wrote:
> Hello!
>
>   
>
> UniVerse 10.1, HP/UX, Pick.
>
>   
>
> Is there a way I can build a save-list from a selection from one file
> X.INFO (where the record ID is an 8 digit number) and use that list to
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL this
> would be considered a join and would look something like this:
>
>   
>
> select *
>
> from X.INFO, Y.INFO
>
> where X.INFO.packet.id=Y.INFO.packet.id
>
> and X.INFO.status='ccc';
>
>   
>
> I can run this in TCL and have it return the results I want but can't
> build a save-list from it because I don't know the UniVerse/SQL syntax
> to do so.
>
>   
>
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?
>
>   
>
> Thanks for any advice you can give.
>
>   
>
> ___
> U2-Users mailing list
> U2-Users@listserver.u2ug.org
> http://listserver.u2ug.org/mailman/listinfo/u2-users
>

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Martin Phillips
Hi Tony,

Not one of my greater postings. I tidied it up a bit but seem to left a stray 
ELSE in place.

3/10 could try harder!!


Martin

-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tony Gravagno
Sent: 28 August 2013 15:04
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Select from one file with save-list from another file

This line caught my eye:
> readlist var from 10 else then result = lower(var)

"else then" ?

I get it, but ... yuck. :)

T

> From: Martin Phillips 
> Spotted a bug - I knew this would turn out to be the wrong source
> code!!...


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Tony Gravagno
This line caught my eye:
> readlist var from 10 else then result = lower(var)

"else then" ?

I get it, but ... yuck. :)

T

> From: Martin Phillips 
> Spotted a bug - I knew this would turn out to be the wrong source
> code!!...


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Martin Phillips
Hi again,

Spotted a bug - I knew this would turn out to be the wrong source code!!

When opening a new file, the filename should be copied to fname.


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Martin Phillips
Sent: 28 August 2013 13:55
To: 'U2 Users List'
Subject: Re: [U2] Select from one file with save-list from another file

Hi,

Long ago, I wrote an OUTERJOIN() function that could be called from an I-type 
using the SUBR(). This became a built-in function in
QM but I think that the source code I have tracked down and shown below for the 
UniVerse version is about right.

subroutine ojoin(result, file.name, index.name, indexed.value)
   common /ojoin/fname, fvar

   result= ''

   if fname # file.name then
  open file.name to fvar else
 display 'Cannot open ' : file.name
 return
  end
   end

   selectindex index.name, indexed.value from fvar to 10
   if status() then
  display 'Index ' : index.name : ' not present in ' : file.name
  return
   end

   readlist var from 10 else then result = lower(var)
   return
end


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Martin Phillips
Hi,

Long ago, I wrote an OUTERJOIN() function that could be called from an I-type 
using the SUBR(). This became a built-in function in
QM but I think that the source code I have tracked down and shown below for the 
UniVerse version is about right.

subroutine ojoin(result, file.name, index.name, indexed.value)
   common /ojoin/fname, fvar

   result= ''

   if fname # file.name then
  open file.name to fvar else
 display 'Cannot open ' : file.name
 return
  end
   end

   selectindex index.name, indexed.value from fvar to 10
   if status() then
  display 'Index ' : index.name : ' not present in ' : file.name
  return
   end

   readlist var from 10 else then result = lower(var)
   return
end


Martin Phillips
Ladybridge Systems Ltd
17b Coldstream Lane, Hardingstone, Northampton NN4 6DB, England
+44 (0)1604-709200



-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Tony Gravagno
Sent: 28 August 2013 13:18
To: u2-users@listserver.u2ug.org
Subject: Re: [U2] Select from one file with save-list from another file

Not sure where to toss this into this thread so I'll start at the
beginning. I wanted to see the solutions that would be offered. I
blogged on exactly this topic back in 2008. The solution I published
for D3 uses @environment variables to allow us to do inner queries
with a tiny bit of simple and reusable code, no dict items, no work
files, and no save-lists. Perhaps someone can describe the
UD/UV-specific equivalents so that we can accomplish this here using
similar methods? I'll be happy to add the U2 solution to the blog for
future reference.
http://Nebula-RnD.com/blog/tech/mv/2008/03/d3shell1.html



Tony Gravagno   
Nebula Research and Development 
TG@ remove.pleaseNebula-RnD.com 
http://Nebula-RnD.com/blog  
http://LinkedIn.com/in/TonyGravagno 
http://Twitter.com/TonyGravagno 
http://PickWiki.com 
http://groups.google.com/group/MVDBMS   
http://www.LinkedIn.com/groups/Pick-Users-Group-64935   
http://BitBucket.org/FOSS4MV/



> From: Hilk, Brandon 
> UniVerse 10.1, HP/UX, Pick.
> Is there a way I can build a save-list from a selection from one
file
> X.INFO (where the record ID is an 8 digit number) and use that list
to
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL
this
> would be considered a join and would look something like this:
> 
> select *
> from X.INFO, Y.INFO
> where X.INFO.packet.id=Y.INFO.packet.id
> and X.INFO.status='ccc';
> 
> I can run this in TCL and have it return the results I want but
can't build
> a save-list from it because I don't know the UniVerse/SQL syntax to
do
> so.
> 
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Tony Gravagno
Not sure where to toss this into this thread so I'll start at the
beginning. I wanted to see the solutions that would be offered. I
blogged on exactly this topic back in 2008. The solution I published
for D3 uses @environment variables to allow us to do inner queries
with a tiny bit of simple and reusable code, no dict items, no work
files, and no save-lists. Perhaps someone can describe the
UD/UV-specific equivalents so that we can accomplish this here using
similar methods? I'll be happy to add the U2 solution to the blog for
future reference.
http://Nebula-RnD.com/blog/tech/mv/2008/03/d3shell1.html



Tony Gravagno   
Nebula Research and Development 
TG@ remove.pleaseNebula-RnD.com 
http://Nebula-RnD.com/blog  
http://LinkedIn.com/in/TonyGravagno 
http://Twitter.com/TonyGravagno 
http://PickWiki.com 
http://groups.google.com/group/MVDBMS   
http://www.LinkedIn.com/groups/Pick-Users-Group-64935   
http://BitBucket.org/FOSS4MV/



> From: Hilk, Brandon 
> UniVerse 10.1, HP/UX, Pick.
> Is there a way I can build a save-list from a selection from one
file
> X.INFO (where the record ID is an 8 digit number) and use that list
to
> select from file Y.INFO (where that 8 digit number is not the record
ID
> but does exist as a "foreign key" elsewhere in the file). In SQL
this
> would be considered a join and would look something like this:
> 
> select *
> from X.INFO, Y.INFO
> where X.INFO.packet.id=Y.INFO.packet.id
> and X.INFO.status='ccc';
> 
> I can run this in TCL and have it return the results I want but
can't build
> a save-list from it because I don't know the UniVerse/SQL syntax to
do
> so.
> 
> So to summarize, is there a way to use a save-list built from X.INFO
to
> make another save-list comprised of the record ID's from Y.INFO?


___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users


Re: [U2] Select from one file with save-list from another file

2013-08-28 Thread Charles Stevenson
P.S.   If there is a many::1 relationship between X.FILE & Y.FILE,  
i.e., if more than 1 X.FILE record can have the same Y.INFO foreign key 
in it,

do this:

SELECT X.FILE WITH STATUS = "cc"  SAVING UNIQUE Y.PACKET.ID
LIST Y.FILE



On 8/28/2013 9:56 AM, Charles Stevenson wrote:

I'm with Ian.
Maybe Ian and I don't understand the question.   The other answers 
seem so complicated.


Brandon, Replace Ian's example "Y.PACKET.ID" with whatever is thereal 
name in DICT X.INFO  pointing to  what you describa ase Y.INFO's key 
exists as a "foreign key" somewhere in X.INFO.


Give Ian's code a try and see if it gives you what you want.
You don't even need to do the SAVE.LIST & GET.LIST.  That's just so 
you can have the list for later use or examination.


Chuck


On 8/28/2013 1:32 AM, McGowan, Ian wrote:
At least on Unidata you can put the foreign key in the select 
statement, and that's the id that will be used:


#SELECT X WITH STATUS = "ccc" Y.PACKET.ID
#SAVE.LIST L1
#GET.LIST L1
#LIST Y

If you put two atb names in the select, they are interleaved in the 
resulting saved list, which can be a quick way to export some data...


-Original Message-
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Hilk, Brandon

Sent: Tuesday, August 27, 2013 1:24 PM
To: u2-users@listserver.u2ug.org
Subject: [U2] Select from one file with save-list from another file

Hello!


UniVerse 10.1, HP/UX, Pick.


Is there a way I can build a save-list from a selection from one file 
X.INFO (where the record ID is an 8 digit number) and use that list 
to select from file Y.INFO (where that 8 digit number is not the 
record ID but does exist as a "foreign key" elsewhere in the file). 
In SQL this would be considered a join and would look something like 
this:



select *

from X.INFO, Y.INFO

where X.INFO.packet.id=Y.INFO.packet.id

and X.INFO.status='ccc';


I can run this in TCL and have it return the results I want but can't 
build a save-list from it because I don't know the UniVerse/SQL 
syntax to do so.



So to summarize, is there a way to use a save-list built from X.INFO 
to make another save-list comprised of the record ID's from Y.INFO?



Thanks for any advice you can give.





___
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users