Declare global in called table goes away following lookup?
Barry Wiseman
barry at gensoftdes.com
Sun Aug 19 13:02:34 PDT 2007
Linux dclerk 5.0.14D4 (I know, I know)
My variable is a declare global in the called table, a declare extern in the
main table. I am loading the variable in the main table, then doing the call.
All is well until the called code performs a lookup, following which the
variable has become blank. The following test code demonstrates the problem:
-------------------
MAIN TABLE
-------------------
::end:
@MENU::call "library/test" ' so declare globals will be performed:
::end:
::':
::declare extern MyFile:
::declare extern MyKey:
::declare extern Flag:
::':
@ENTSEL::MyFile=@fi; MyKey=1:
::msgbox "Calling table\nMyKey=" { MyKey:
::Flag="1":
::call "library/test":
::end:
------------------------
CALLED TABLE
------------------------
::declare global MyFile(10,*):
::declare global MyKey(10,*):
::declare global Flag(1,*):
:Flag eq "1":goto one:
::end:
::':
ONE::msgbox "Called table before lookup\nMyKey=" { MyKey ' here MyKey has its
value:
::lookup rec = (MyFile) k=(MyKey) i=a -bx:
::msgbox "Called table after lookup\nMyKey=" { MyKey ' here MyKey has
become blank:
::end:
This behavior occurs only when the lookup is back to the file the main table is
standing on, and is not affected by whether the lookup succeeded or failed.
When I load MyFile with some other filename instead of @fi, then MyKey retains
its value in the final msgbox.
I can of course easily work around this by saving the global data into local
variables and using them instead, but!
If it walks like a bug, and quacks like a bug....
--
Barry Wiseman
Genesis Software Designs, Inc.
55 W 45 Street, New York, NY 10036
(212) 889-9191 Fax: (212) 889-1589
More information about the Filepro-list
mailing list