You can just use the CLEARSELECT function in your basic code on UV, instead of using execute or perform. Tom
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dan McGrath Sent: Monday, October 12, 2009 5:56 PM To: U2 Users List Subject: Re: [U2] EXECUTE 'CLEARSELECT' Thanks for the replies, @David Hona Thanks for that. There shouldn't be an issue with the execution layer of EXECUTE in regards to select lists as the following processes correctly: Giving a FILE, X with 3 records: AA, AB and BB EXECUTE 'SELECT X with @ID = "A]"' EXECUTE 'SELECT X with @ID = "[B"' Correctly returns 1 record, AB. I tested all the EXECUTE/PERFORM variants with the below code and the only one that makes a difference is UDTEXECUTE "CLEARSELECT", which works as advertised. The difference between UDTEXECUTE and EXECUTE is that UDTEXECUTE always processes the commands in ECLTYPE U. >From the Manual for UDTEXECUTE: "When you compile a program in BASICTYPE P, EXECUTE or PERFORM passes the string to execute to a nonstandard UniData parser. This parser looks for a specific sentence structure common to BASICTYPE P systems. Standard UniQuery sentences might not be handled correctly in this circumstance. Therefore, when you want to execute a standard UniQuery statement from within a UniBasic program that has been compiled in BASICTYPE P, use the UDTEXECUTE command instead of EXECUTE or PERFORM." CLEARSELECT, however, should be valid for Pick and should function correctly. This leads me to believe, at least in UD 7.1, that the Pick Parser used in EXECUTE when in BASICTYPE P is broken in regards to CLEARSELECT (As evidenced by the SELECT response and SYSTEM(11) disagreement.) Our problem now is that we have many existing programs that use EXECUTE "CLEARSELECT" that we now need to verify are functioning correctly and fix as required. Mainly, I was interested if anyone else who has to operate their UD system in ECLTYPE P, BASICTYPE P that is - Aware of this issue, - Can verify it outside of 7.1 (Eg, 7.2) @David Laansma Yes, we are aware of that. The below code is simply a trivial example program to demonstration the issue. The issue comes into play when, for example, you do a SELECT on a FILE and need to bail out part way through processing the select list, then attempt to perform a new SELECT the same file. In this case, if your program is compiled in BASICTYPE P and used EXECUTE "CLEARSELECT" to clear the select list from the first SELECT, it will not actually clear the select list and result in the second SELECT being incorrect. Regards, Dan -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Dave Laansma Sent: Monday, 12 October 2009 11:03 PM To: U2 Users List Subject: Re: [U2] EXECUTE 'CLEARSELECT' If you goal is to simply count the number of records that match a criteria, consider the COUNT statement. David Laansma IT Manager Hubbard Supply Co. Direct: 810-342-7143 Office: 810-234-8681 Fax: 810-234-6142 www.hubbardsupply.com "Delivering Products, Services and Innovative Solutions" -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Hona, David Sent: Monday, October 12, 2009 12:55 AM To: U2 Users List Subject: Re: [U2] EXECUTE 'CLEARSELECT' This usually indicates that your EXECUTE is executing at a different execution layer. Prime INFORMATION did this by default and had to use PERFORM to use the same runtime execution layer or overide with a $option statement. ________________________________________ From: [email protected] [[email protected]] On Behalf Of Dan McGrath [[email protected]] Sent: Monday, 12 October 2009 1:56 PM To: [email protected] Subject: [U2] EXECUTE 'CLEARSELECT' Hi all, One of the programmers here has noticed this quirky behaviour in Unidata 7.1. First, we created a file called TEST and gave it 3 records, AA, AB and AC. Then we executed the following program: PROGRAM TEST CLEARSELECT EXECUTE 'SELECT TEST WITH @ID = "A]"' CRT "Records after SELECT ":SYSTEM(11) READNEXT KEY ELSE NULL EXECUTE "CLEARSELECT" CRT "Records after EXECUTE CLEARSELECT: ":SYSTEM(11) EXECUTE 'SELECT TEST WITH @ID = "A]"' CRT "Records after SELECT ":SYSTEM(11) READNEXT KEY ELSE NULL CLEARSELECT CRT "Records after CLEARSELECT: ":SYSTEM(11) EXECUTE 'SELECT TEST WITH @ID = "A]"' CRT "Records after SELECT ":SYSTEM(11) STOP and received the following results: 3 records selected to list 0. Records after SELECT 3 Records after EXECUTE CLEARSELECT: 2 3 records selected to list 0. Records after SELECT 2 Records after CLEARSELECT: 0 3 records selected to list 0. Records after SELECT 3 We would expect SYSTEM(11) to return 0 after the EXECUTE "CLEARSELECT" but it returns how many items were in the list prior to the CLEARSELECT. Also odd is that the select itself returns that it selected 3 records, but then SYSTEM(11) reports 2 and READNEXT will only extract 2 from the list. The work around is to use Unibasic CLEARSELECT which functions correctly as demonstrated above. When testing this using BASICTYPE "u" and "WHEN @ID LIKE" the issue did not present itself. I have tested both UNIX and Windows. Does this happen in 7.2? Regards, Dan ######################################################################## ################### The information transmitted in this message and attachments (if any) is intended only for the person or entity to which it is addressed. The message may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. The intended recipient of this e-mail may only use, reproduce, disclose or distribute the information contained in this e-mail and any attached files with the permission of IMB. ######################################################################## ################### _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users ************** IMPORTANT MESSAGE ***************************** This e-mail message is intended only for the addressee(s) and contains information which may be confidential. If you are not the intended recipient please advise the sender by return email, do not use or disclose the contents, and delete the message and any attachments from your system. Unless specifically indicated, this email does not constitute formal advice or commitment by the sender or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries. We can be contacted through our web site: commbank.com.au. If you no longer wish to receive commercial electronic messages from us, please reply to this e-mail by typing Unsubscribe in the subject line. ************************************************************** _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ ########################################################################################### The information transmitted in this message and attachments (if any) is intended only for the person or entity to which it is addressed. The message may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. The intended recipient of this e-mail may only use, reproduce, disclose or distribute the information contained in this e-mail and any attached files with the permission of IMB. ########################################################################################### _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
