[U2] Doing Multiple Selects in BASIC and combining the lists
This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Doing Multiple Selects in BASIC and combining the lists
try: HELP MERGE.LIST John Thompson wrote: This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Doing Multiple Selects in BASIC and combining the lists
In a nutshell SELECT FILE WITH VALUE = 'A' TO 1 SELECT FILE WITH VALUE = 'B' TO 2 MERGE.LIST 1 UNION 2 TO 0 SORT FILE VALUE -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 12:16 PM To: U2 Users List Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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] Doing Multiple Selects in BASIC and combining the lists
I'm not sure I'd combine them; handle the data once. I'd readext through file1_list, then readnext through file2_list. ...and I'd probably use the basic select, making AMOUNT=112.50 my first filter. Again, then you only read the data once. (Exception: if the field is indexed, I'd go with an external select)(If AMOUNT is indexed, you probably have too many indices...;)) Date: Wed, 27 Jul 2011 13:15:40 -0400 From: jthompson...@gmail.com To: u2-users@listserver.u2ug.org Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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] Doing Multiple Selects in BASIC and combining the lists
Thanks for the help. You guys are way better than typing in the word LIST in the pdf manuals and hoping to find what you are looking for :) On Wed, Jul 27, 2011 at 1:26 PM, Dan Fitzgerald dangf...@hotmail.comwrote: I'm not sure I'd combine them; handle the data once. I'd readext through file1_list, then readnext through file2_list. ...and I'd probably use the basic select, making AMOUNT=112.50 my first filter. Again, then you only read the data once. (Exception: if the field is indexed, I'd go with an external select)(If AMOUNT is indexed, you probably have too many indices...;)) Date: Wed, 27 Jul 2011 13:15:40 -0400 From: jthompson...@gmail.com To: u2-users@listserver.u2ug.org Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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 -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Doing Multiple Selects in BASIC and combining the lists
Ok, got stuck again... How would your example play out in BASIC? Its just a bunch of archive info in a file that only has a couple of indexes, but, I would like to look at the active file as well... EXECUTE \SELECT FILE1 WITH VALUE = 'A' TO 1\ EXECUTE \SELECT FILE2 WITH VALUE = 'A' TO 2\ EXECUTE \MERGE.LIST 1 UNION 2 TO 0\ I get an error claiming select list 1 is not active this way. I need the selects to be separate and not stack. I know how to stack them with PASSLIST and RTNLIST... I'm just fuzzy on how to do them separately and then combine them? Would I need to save them and use LIST.UNION? Or just do the two READNEXTS? (I'm trying to avoid because the READNEXT loop is kind of big) Any help is appreciated. On Wed, Jul 27, 2011 at 1:22 PM, Buffington, Wyatt wgbuffing...@hydro.mb.ca wrote: In a nutshell SELECT FILE WITH VALUE = 'A' TO 1 SELECT FILE WITH VALUE = 'B' TO 2 MERGE.LIST 1 UNION 2 TO 0 SORT FILE VALUE -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 12:16 PM To: U2 Users List Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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 -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Doing Multiple Selects in BASIC and combining the lists
EXECUTE SELECT FILE WITH VALUE = 'A' TO 1 EXECUTE SELECT FILE WITH VALUE = 'B' TO 2 EXECUTE MERGE.LIST 1 UNION 2 TO 0 TOT.VAL = 0 END.OF.LIST = FALSE LOOP READNEXT KEY FROM 0 ELSE END.OF.LIST = TRUE UNTIL END.OF.LIST = TRUE DO READ RECORD FROM FILE, KEY THEN VALUE= OCONV(RECORDX,'MD2') TOT.VAL += VAL END REPEAT -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 1:17 PM To: U2 Users List Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists Ok, got stuck again... How would your example play out in BASIC? Its just a bunch of archive info in a file that only has a couple of indexes, but, I would like to look at the active file as well... EXECUTE \SELECT FILE1 WITH VALUE = 'A' TO 1\ EXECUTE \SELECT FILE2 WITH VALUE = 'A' TO 2\ EXECUTE \MERGE.LIST 1 UNION 2 TO 0\ I get an error claiming select list 1 is not active this way. I need the selects to be separate and not stack. I know how to stack them with PASSLIST and RTNLIST... I'm just fuzzy on how to do them separately and then combine them? Would I need to save them and use LIST.UNION? Or just do the two READNEXTS? (I'm trying to avoid because the READNEXT loop is kind of big) Any help is appreciated. On Wed, Jul 27, 2011 at 1:22 PM, Buffington, Wyatt wgbuffing...@hydro.mb.ca wrote: In a nutshell SELECT FILE WITH VALUE = 'A' TO 1 SELECT FILE WITH VALUE = 'B' TO 2 MERGE.LIST 1 UNION 2 TO 0 SORT FILE VALUE -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 12:16 PM To: U2 Users List Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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 -- John Thompson ___ 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] Doing Multiple Selects in BASIC and combining the lists
If I understand correctly, you're going to end up with a list that has entities from two files, therefore you're going to need to do a test when you do the read to see which file the ID came from and ergo which file to read So to add to the code below, you'd need READ RECORD FROM FILE1, KEY THEN GOSUB PROCESS.RECORD END ELSE READ RECORD FROM FILE2, KEY THEN GOSUB PROCESS.RECORD END ELSE PRINT KEY : ' WAS NOT IN EITHER FILE???' INPUT WAKKA.WAKKA END END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Buffington, Wyatt Sent: Wednesday, July 27, 2011 11:27 AM To: U2 Users List Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists EXECUTE SELECT FILE WITH VALUE = 'A' TO 1 EXECUTE SELECT FILE WITH VALUE = 'B' TO 2 EXECUTE MERGE.LIST 1 UNION 2 TO 0 TOT.VAL = 0 END.OF.LIST = FALSE LOOP READNEXT KEY FROM 0 ELSE END.OF.LIST = TRUE UNTIL END.OF.LIST = TRUE DO READ RECORD FROM FILE, KEY THEN VALUE= OCONV(RECORDX,'MD2') TOT.VAL += VAL END REPEAT -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 1:17 PM To: U2 Users List Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists Ok, got stuck again... How would your example play out in BASIC? Its just a bunch of archive info in a file that only has a couple of indexes, but, I would like to look at the active file as well... EXECUTE \SELECT FILE1 WITH VALUE = 'A' TO 1\ EXECUTE \SELECT FILE2 WITH VALUE = 'A' TO 2\ EXECUTE \MERGE.LIST 1 UNION 2 TO 0\ I get an error claiming select list 1 is not active this way. I need the selects to be separate and not stack. I know how to stack them with PASSLIST and RTNLIST... I'm just fuzzy on how to do them separately and then combine them? Would I need to save them and use LIST.UNION? Or just do the two READNEXTS? (I'm trying to avoid because the READNEXT loop is kind of big) Any help is appreciated. On Wed, Jul 27, 2011 at 1:22 PM, Buffington, Wyatt wgbuffing...@hydro.mb.ca wrote: In a nutshell SELECT FILE WITH VALUE = 'A' TO 1 SELECT FILE WITH VALUE = 'B' TO 2 MERGE.LIST 1 UNION 2 TO 0 SORT FILE VALUE -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 12:16 PM To: U2 Users List Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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 -- John Thompson ___ 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] Doing Multiple Selects in BASIC and combining the lists
Yes it occurred to me some minutes ago that they ID's in the two files are different, so you are correct. So I'll probably end up just doing the two readnext's anyway like a previous poster suggested. However, thanks for all the examples. I started out on an older PICK system that did not have multiple select lists, I have never used the feature that much, and I'm pretty new to it, and sometimes I wish they just stored the lists in a BASIC program as dynamic arrays... On Wed, Jul 27, 2011 at 2:56 PM, Allen E. Elwood aelw...@socal.rr.comwrote: If I understand correctly, you're going to end up with a list that has entities from two files, therefore you're going to need to do a test when you do the read to see which file the ID came from and ergo which file to read So to add to the code below, you'd need READ RECORD FROM FILE1, KEY THEN GOSUB PROCESS.RECORD END ELSE READ RECORD FROM FILE2, KEY THEN GOSUB PROCESS.RECORD END ELSE PRINT KEY : ' WAS NOT IN EITHER FILE???' INPUT WAKKA.WAKKA END END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Buffington, Wyatt Sent: Wednesday, July 27, 2011 11:27 AM To: U2 Users List Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists EXECUTE SELECT FILE WITH VALUE = 'A' TO 1 EXECUTE SELECT FILE WITH VALUE = 'B' TO 2 EXECUTE MERGE.LIST 1 UNION 2 TO 0 TOT.VAL = 0 END.OF.LIST = FALSE LOOP READNEXT KEY FROM 0 ELSE END.OF.LIST = TRUE UNTIL END.OF.LIST = TRUE DO READ RECORD FROM FILE, KEY THEN VALUE= OCONV(RECORDX,'MD2') TOT.VAL += VAL END REPEAT -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 1:17 PM To: U2 Users List Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists Ok, got stuck again... How would your example play out in BASIC? Its just a bunch of archive info in a file that only has a couple of indexes, but, I would like to look at the active file as well... EXECUTE \SELECT FILE1 WITH VALUE = 'A' TO 1\ EXECUTE \SELECT FILE2 WITH VALUE = 'A' TO 2\ EXECUTE \MERGE.LIST 1 UNION 2 TO 0\ I get an error claiming select list 1 is not active this way. I need the selects to be separate and not stack. I know how to stack them with PASSLIST and RTNLIST... I'm just fuzzy on how to do them separately and then combine them? Would I need to save them and use LIST.UNION? Or just do the two READNEXTS? (I'm trying to avoid because the READNEXT loop is kind of big) Any help is appreciated. On Wed, Jul 27, 2011 at 1:22 PM, Buffington, Wyatt wgbuffing...@hydro.mb.ca wrote: In a nutshell SELECT FILE WITH VALUE = 'A' TO 1 SELECT FILE WITH VALUE = 'B' TO 2 MERGE.LIST 1 UNION 2 TO 0 SORT FILE VALUE -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 12:16 PM To: U2 Users List Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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 -- John Thompson ___ 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 -- John Thompson ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Doing Multiple Selects in BASIC and combining the lists
John Said and sometimes I wish they just stored the lists in a BASIC program as dynamic arrays... There is the READLIST verb. That takes a list and makes a dynamic array with it. P type uses READSELECT. Charles Shaffer Senior Analyst NTN-Bower Corporation ___ U2-Users mailing list U2-Users@listserver.u2ug.org http://listserver.u2ug.org/mailman/listinfo/u2-users
Re: [U2] Doing Multiple Selects in BASIC and combining the lists
The lists are stored in SAVEDLISTS as a multi-attribute dynamic array John Thompson wrote: Yes it occurred to me some minutes ago that they ID's in the two files are different, so you are correct. So I'll probably end up just doing the two readnext's anyway like a previous poster suggested. However, thanks for all the examples. I started out on an older PICK system that did not have multiple select lists, I have never used the feature that much, and I'm pretty new to it, and sometimes I wish they just stored the lists in a BASIC program as dynamic arrays... On Wed, Jul 27, 2011 at 2:56 PM, Allen E. Elwood aelw...@socal.rr.comwrote: If I understand correctly, you're going to end up with a list that has entities from two files, therefore you're going to need to do a test when you do the read to see which file the ID came from and ergo which file to read So to add to the code below, you'd need READ RECORD FROM FILE1, KEY THEN GOSUB PROCESS.RECORD END ELSE READ RECORD FROM FILE2, KEY THEN GOSUB PROCESS.RECORD END ELSE PRINT KEY : ' WAS NOT IN EITHER FILE???' INPUT WAKKA.WAKKA END END -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Buffington, Wyatt Sent: Wednesday, July 27, 2011 11:27 AM To: U2 Users List Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists EXECUTE SELECT FILE WITH VALUE = 'A' TO 1 EXECUTE SELECT FILE WITH VALUE = 'B' TO 2 EXECUTE MERGE.LIST 1 UNION 2 TO 0 TOT.VAL = 0 END.OF.LIST = FALSE LOOP READNEXT KEY FROM 0 ELSE END.OF.LIST = TRUE UNTIL END.OF.LIST = TRUE DO READ RECORD FROM FILE, KEY THEN VALUE= OCONV(RECORDX,'MD2') TOT.VAL += VAL END REPEAT -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 1:17 PM To: U2 Users List Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists Ok, got stuck again... How would your example play out in BASIC? Its just a bunch of archive info in a file that only has a couple of indexes, but, I would like to look at the active file as well... EXECUTE \SELECT FILE1 WITH VALUE = 'A' TO 1\ EXECUTE \SELECT FILE2 WITH VALUE = 'A' TO 2\ EXECUTE \MERGE.LIST 1 UNION 2 TO 0\ I get an error claiming select list 1 is not active this way. I need the selects to be separate and not stack. I know how to stack them with PASSLIST and RTNLIST... I'm just fuzzy on how to do them separately and then combine them? Would I need to save them and use LIST.UNION? Or just do the two READNEXTS? (I'm trying to avoid because the READNEXT loop is kind of big) Any help is appreciated. On Wed, Jul 27, 2011 at 1:22 PM, Buffington, Wyatt wgbuffing...@hydro.mb.ca wrote: In a nutshell SELECT FILE WITH VALUE = 'A' TO 1 SELECT FILE WITH VALUE = 'B' TO 2 MERGE.LIST 1 UNION 2 TO 0 SORT FILE VALUE -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 12:16 PM To: U2 Users List Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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 -- John Thompson ___ 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 -- Jeff Schasny - Denver, Co, USA jschasny at gmail dot com
Re: [U2] Doing Multiple Selects in BASIC and combining the lists
John, I'm guessing you're using a PICK account, to use numbered select lists in these accounts you must have $OPTIONS -S in the code. Also multiple TCL commands can be combined together just as in a PA VOC type avoiding the need for multiple EXECUTE's so the code could look something like this:- $OPTIONS -S PARAGRAPH = \SELECT FILE1 WITH VALUE = 'A' TO 1 COUNT.SUP\ PARAGRAPH-1 = \SELECT FILE2 WITH VALUE = 'A' TO 2 COUNT.SUP\ PARAGRAPH-1 = \MERGE.LIST 1 UNION 2 COUNT.SUP\ PERFORM PARAGRAPH PERFORM is more efficient than EXECUTE and the COUNT.SUP suppresses the nn records selected message. You should also be aware that MERGE.LIST does a left justified sort on the records and removes any duplicates. HTH, Andy From: John Thompson jthompson...@gmail.com To: U2 Users List u2-users@listserver.u2ug.org Sent: Wednesday, 27 July 2011, 19:16 Subject: Re: [U2] Doing Multiple Selects in BASIC and combining the lists Ok, got stuck again... How would your example play out in BASIC? Its just a bunch of archive info in a file that only has a couple of indexes, but, I would like to look at the active file as well... EXECUTE \SELECT FILE1 WITH VALUE = 'A' TO 1\ EXECUTE \SELECT FILE2 WITH VALUE = 'A' TO 2\ EXECUTE \MERGE.LIST 1 UNION 2 TO 0\ I get an error claiming select list 1 is not active this way. I need the selects to be separate and not stack. I know how to stack them with PASSLIST and RTNLIST... I'm just fuzzy on how to do them separately and then combine them? Would I need to save them and use LIST.UNION? Or just do the two READNEXTS? (I'm trying to avoid because the READNEXT loop is kind of big) Any help is appreciated. On Wed, Jul 27, 2011 at 1:22 PM, Buffington, Wyatt wgbuffing...@hydro.mb.ca wrote: In a nutshell SELECT FILE WITH VALUE = 'A' TO 1 SELECT FILE WITH VALUE = 'B' TO 2 MERGE.LIST 1 UNION 2 TO 0 SORT FILE VALUE -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of John Thompson Sent: Wednesday, July 27, 2011 12:16 PM To: U2 Users List Subject: [U2] Doing Multiple Selects in BASIC and combining the lists This may be an easy one, or a hard one, however, I realized I don't recall ever having to do this until today, or I could just be tired... How can you do a SELECT from two different files in a BASIC program and then combine the lists of ID's so that you can do a READNEXT on it? I ask this because I believe by default that Universe does not store the select lists as dynamic arrays. For example: EXECUTE \SELECT FILE1 WITH AMOUNT = 112.50\ RTNLIST FILE1_LIST EXECUTE \SELECT FILE2 WITH AMOUNT = 112.50\ RTNLIST FILE2_LIST ...Code to combine FILE1_LIST and FILE2_LIST into FINAL_LIST... REANEXT ID FROM FINAL_LIST THEN do something NEXT ID I am using Universe 10.3.x on AIX 5.3. I'm in a PICK flavor account. -- John Thompson ___ 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 -- John Thompson ___ 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