RE: [U2] passing file pointers?
If unassigned(F.PTR) then open 'f' to F.PTR... -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Chanco Sent: 02 May 2008 10:21 PM To: u2-users@listserver.u2ug.org Subject: [U2] passing file pointers? Hey all, In universe 10.1 how can I verify that a file pointer passed via a subroutine param is valid? I have a subroutine that is called with several file pointers but it is possible to be called without opening a file and the subroutine would check if the file pointer is empty and if so open the file. The problem is that my check IF F.PTR = '' THEN Is erroring out with a invalid data type error message when the file pointer is passed in (instead of being null). I know that I can make all the calling programs open the needed files BEFORE calling the subroutine BUT if its possible to somehow have the subroutine check and open it if its (empty the file pointer), I would prefer to do that. Thoughts/suggestions welcome Thanks! dougc --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ -- No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.8/1414 - Release Date: 2008/05/04 12:31 PM --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] passing file pointers?
FILEINFO() will fail if the argument is passed in an unassigned state or is null. Therefore, when creating routines that programs written by anyone I will usually test first with UNASSIGNED and ISNULL before going on to other checks such as FILEINFO or NUM. --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] passing file pointers?
Use the Fileinfo routine. If fileinfo(fv,1) = (if 0 not open, if 1 open) This checks that is a valid file that is open. This is good practice to test the file is open before opening, as reopening the file clears all previous record locks held on that file by that user and can cause fatal errors when using transaction boundaries Regards David Jordan --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] passing file pointers?
Wouldn't even BETTER practice be to just ensure that the file is open in the calling program? If this is a well used routine that is called for a couple of million records, then even the overhead of this simple check can quickly mount. Whilst I agree that it is good that code should try catch errors, I think that this is a classic example of where the real fix is to fix the problem that is in the calling routine removes a whole error trap routine (what DO you do if the file isn't open this is in the middle of a batch update?) that shouldn't exist in the first place. YMMV Ross Ferris Stamina Software Visage Better by Design! -Original Message- From: [EMAIL PROTECTED] [mailto:owner-u2- [EMAIL PROTECTED] On Behalf Of David Jordan Sent: Sunday, 4 May 2008 10:11 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] passing file pointers? Use the Fileinfo routine. If fileinfo(fv,1) = (if 0 not open, if 1 open) This checks that is a valid file that is open. This is good practice to test the file is open before opening, as reopening the file clears all previous record locks held on that file by that user and can cause fatal errors when using transaction boundaries Regards David Jordan --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] passing file pointers?
All GREAT points but when you are dealing with old code that they want to just maintain and NOT enhance this is the kind of situations you have to deal with. I COMPLETELY agree with you but sadly my company is moving to a vb.net front end and maintaing the green screen side of the system has a incredibly low priority. anyway thanks to everyone for their responses and ideas they are all appriciated! thanks everyone dougc -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ross Ferris Sent: Sunday, May 04, 2008 8:33 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] passing file pointers? Wouldn't even BETTER practice be to just ensure that the file is open in the calling program? If this is a well used routine that is called for a couple of million records, then even the overhead of this simple check can quickly mount. Whilst I agree that it is good that code should try catch errors, I think that this is a classic example of where the real fix is to fix the problem that is in the calling routine removes a whole error trap routine (what DO you do if the file isn't open this is in the middle of a batch update?) that shouldn't exist in the first place. YMMV Ross Ferris Stamina Software Visage Better by Design! -Original Message- From: [EMAIL PROTECTED] [mailto:owner-u2- [EMAIL PROTECTED] On Behalf Of David Jordan Sent: Sunday, 4 May 2008 10:11 PM To: u2-users@listserver.u2ug.org Subject: RE: [U2] passing file pointers? Use the Fileinfo routine. If fileinfo(fv,1) = (if 0 not open, if 1 open) This checks that is a valid file that is open. This is good practice to test the file is open before opening, as reopening the file clears all previous record locks held on that file by that user and can cause fatal errors when using transaction boundaries Regards David Jordan --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ __ Information from ESET NOD32 Antivirus, version of virus signature database 3072 (20080503) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 3072 (20080503) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
RE: [U2] passing file pointers?
Something like this should do the trick IF ASSIGNED(F.PTR) THEN STATUS STUFF FROM F.PTR ELSE * FILE POINTER IS INVALID) END END ELSE * FILE POINTER IS NOT ASSIGNED/OPENED END -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Chanco Sent: Friday, May 02, 2008 3:21 PM To: u2-users@listserver.u2ug.org Subject: [U2] passing file pointers? Hey all, In universe 10.1 how can I verify that a file pointer passed via a subroutine param is valid? I have a subroutine that is called with several file pointers but it is possible to be called without opening a file and the subroutine would check if the file pointer is empty and if so open the file. The problem is that my check IF F.PTR = '' THEN Is erroring out with a invalid data type error message when the file pointer is passed in (instead of being null). I know that I can make all the calling programs open the needed files BEFORE calling the subroutine BUT if its possible to somehow have the subroutine check and open it if its (empty the file pointer), I would prefer to do that. Thoughts/suggestions welcome Thanks! dougc --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
Re: [U2] passing file pointers?
Check out the FILEINFO function Raul - Original Message - From: Doug Chanco [EMAIL PROTECTED] Sent: 05/02/2008 04:21 PM AST To: u2-users@listserver.u2ug.org Subject: [U2] passing file pointers? Hey all, In universe 10.1 how can I verify that a file pointer passed via a subroutine param is valid? I have a subroutine that is called with several file pointers but it is possible to be called without opening a file and the subroutine would check if the file pointer is empty and if so open the file. The problem is that my check IF F.PTR = '' THEN Is erroring out with a invalid data type error message when the file pointer is passed in (instead of being null). I know that I can make all the calling programs open the needed files BEFORE calling the subroutine BUT if its possible to somehow have the subroutine check and open it if its (empty the file pointer), I would prefer to do that. Thoughts/suggestions welcome Thanks! dougc --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/ --- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/