Hi All -
I just found on our system that exiting a program does not clear an active select list. Im unsure if this is universe specific as I did not have to clear select buffers in Unidata, but this has shown to be an issue here. There is a basic CLEARSELECT statement just as there is at TCL. Is that a standard for anyone running Universe? To use CLEARSELECT in your programs? Do you use it generically when entering or exiting a program?
And now that I've seen this - what other pieces should I be on the lookout for that are saved between programs by user? Obviously named commons and passed variables but...any like this savedlist that might not be obvious?
Lastly, is there an alternative to changing the code? Like an option I could set at tcl or in code that clears the buffers when exiting a program?
Thanks!
------------------------------
Kathleen Hambrick
Programmer at Colwell
------------------------------
Kathleen,
Exiting a program without exhausting the default select list will leave that select list active when a program finishes in both UniVerse and UniData. In terms of using CLEARSELECT when I am writting some of the utiltiy programs in UniVerse and UniData, then yes I will use CLEARSELECT but not necessarly to clear the default list. CLEARSELECT on it's on does all lists, CLEARSELECT n allows to select a particular list.
Some pointers around handling select lists in programs.
You can check to see if the default select list is active in basic and if needed you can write list preservation code to restore the list after execution of program. You may want to do this is do not want the select list to interact with any other EXECUTE / PERFORM commands you may use. List preservation is very application dependant but fairly simple to code.
You may acutally want the program to accept the default select list into your program to process, if not see my comment above around list preservation.
If you want to use other select lists in your program and don't want them to interact with other commands you may EXECUTE / PERFORM then avoid using the default list (i.e list 0), you can use the other list numbers 1 to 9 and most commands that allow list processing allow you to say which list to use. So a typical example in the utiltiy programs I have written in UniVerse and UniData (that are shipped with UV and UD), I will use other list numbers. For example.
CLEARSELECT 5
SELECT F.FILE TO 5 (or EXECUTE 'SELECT FILE WITH ...... TO 5')
EOL5 = 0
LOOP
READNEXT K.FILE FROM 5 ELSE EOL5 = 1
UNTIL EOL5 DO
...
REPEAT
------------------------------
Jonathan Smith
UniData ATS
Rocket Support
------------------------------
Kathleen,
Exiting a program without exhausting the default select list will leave that select list active when a program finishes in both UniVerse and UniData. In terms of using CLEARSELECT when I am writting some of the utiltiy programs in UniVerse and UniData, then yes I will use CLEARSELECT but not necessarly to clear the default list. CLEARSELECT on it's on does all lists, CLEARSELECT n allows to select a particular list.
Some pointers around handling select lists in programs.
You can check to see if the default select list is active in basic and if needed you can write list preservation code to restore the list after execution of program. You may want to do this is do not want the select list to interact with any other EXECUTE / PERFORM commands you may use. List preservation is very application dependant but fairly simple to code.
You may acutally want the program to accept the default select list into your program to process, if not see my comment above around list preservation.
If you want to use other select lists in your program and don't want them to interact with other commands you may EXECUTE / PERFORM then avoid using the default list (i.e list 0), you can use the other list numbers 1 to 9 and most commands that allow list processing allow you to say which list to use. So a typical example in the utiltiy programs I have written in UniVerse and UniData (that are shipped with UV and UD), I will use other list numbers. For example.
CLEARSELECT 5
SELECT F.FILE TO 5 (or EXECUTE 'SELECT FILE WITH ...... TO 5')
EOL5 = 0
LOOP
READNEXT K.FILE FROM 5 ELSE EOL5 = 1
UNTIL EOL5 DO
...
REPEAT
------------------------------
Jonathan Smith
UniData ATS
Rocket Support
------------------------------
Hi Jonathon - I know how to use the clearselect. I have not used it, typically, within a program. On unidata there are udt options and basictypes that clear the list when exiting the program, depending on those settings, for execute, chain, etc. Those either don't exist on universe, or have been turned off on my system.
Can you tell me if they exist in universe? Options and settings that would alter how an active select list is handled when a basic program ends.
Thanks for the information.
Kathleen
------------------------------
Kathleen Hambrick
Programmer at Colwell
------------------------------
Hi Jonathon - I know how to use the clearselect. I have not used it, typically, within a program. On unidata there are udt options and basictypes that clear the list when exiting the program, depending on those settings, for execute, chain, etc. Those either don't exist on universe, or have been turned off on my system.
Can you tell me if they exist in universe? Options and settings that would alter how an active select list is handled when a basic program ends.
Thanks for the information.
Kathleen
------------------------------
Kathleen Hambrick
Programmer at Colwell
------------------------------
@Kathleen Hambrick
Just to clear a few points up on UniData for you, EXECUTE will clear a list as normally what you are executing will take the input from list 0, CHAIN will clear it ... as CHAIN is a one way control to another program with no return, so you would never get back to the original calling program.
The UDT.OPTIONS to which you are talking about are option 11 and 27 which impacts the data stack not the select list itself. Option 81 controls where you are returned to if GET.LIST returns an empty list.
Also for UniData BASICTYPE "P" and ECLTYPE "P" behave exactally the same as type "U" they will still keep the list active.
See the example below note the > prompt after the program has finished, this result is the same for U or P. Below is P
001: EXECUTE 'ECLTYPE'
002: OPEN "VOC" TO F.VOC ELSE STOP
003: SELECT F.VOC
004: END
Bottom.
*--: FIBR
Filed "SELLISTTEST" in file "BP".
Compiling Unibasic: BP\\SELLISTTEST in mode 'p'.
compilation finished
2 U_PSTYLEECL ON
>CLEARSELECT
:
Now in terms of UniVerse I would expect it to behave the same way in regards of EXECUTE and CHAIN under normal conditions.
There is a UniVerse configurable called LAYERSEL which determines whether a select list remains active when returning
from a higher EXECUTE level. A value of 0 maintains an active select list. Any other value clears any select lists before returning to the previous layer, unless K mode is active. The default value is 0.
$OPTIONS PIOPEN.EXECUTE also has effect around active list handling and returning.
Regards,
------------------------------
Jonathan Smith
UniData ATS
Rocket Support
------------------------------