infor.com
concierge
infor u
developer portal
Home
Groups
FACTS - Partner Community
Looking for ability to set and clear a global variable in SMENTY similar to SMFMFM
bob-fitzgibbon
I have used global variables with success in the SMFMFM driver to turn features on and off and used the "Exit Program" to clear these variables so that the features being trapped are only done while in File Maintenance.
But I am having trouble attempting the same type of feature in the SMENTY driver. While I can set the global variable on, the turning it off part is where I am having the trouble. The exit procedure process doesn't execute when the program is ending. I have put procedures in the "exit button procedure" with escapes and they don't get hit, if you just go into the entry program and leave. This leaves the global variable on and causes problems. Other times it gets hit when the document/entity ends but the program doesn't close and if the variable is now turned off you get unreliable results within SMENTY. What I would like is to have the ability to turn off the variable as I leave the SMENTY driver and not while in the driver.
Has anyone accomplished this type of control in the SMENTY driver?
Find more posts tagged with
Comments
Legacy Contributor
I have had some success using such statements as:
local %variable$="ThisValue"
So when you leave the program, it will resort to it's original state ....
sjacquin
Rob, you can also set EXIT_CUST$ to a program to execute when the menu driver gets hit. That program can clear your globals. Just set it when you set the globals.
bob-fitzgibbon
Russ,
Thanks for the idea, but when I set the global variable as a local in the INIT_PROG procedure and step through to the "return" the value is available in that procedure, but once I hit the return the value is lost.
Michael,
Do I set EXIT_CUST$ to a program name or a procedure? I tried exit_cust$="prog/SM/SME00J;exit_program" and that did not hit my escape.
Wichtige Lösungen in der Wissensdatenbank Februar 2013.pdf
sjacquin
What you posted is correct. You should set it to a procedure just as you show, but you have to surround it with "quo" exit_cust$=quo+"prog/SM/SME00J;exit_program"+quo
Legacy Contributor
Yup. You would have to set the local %var$ outside or prior to the call to the driver program, then upon leaving and the enusing return or exit, the variable would be restored. There was no sample code on how the driver program was accessed ....
Legacy Contributor
Rob,
I have frequently used a '*x' procedure, in a file that is opened for the duration of the program, to clear global variables and anything else that needs cleaned up. This ensures that if the program is ended abnormally, the clean up will still take place.
In the init procedure, do something like this:
open (hfn,bsz=1)"*memory*"; mnemonic (lfo)'*X'=pgn+";clean_up"
%my_global_var=1
The bsz=1 uses the smallest amount of memory.
Somewhere in that same program, create the clean_up procedure:
clean_up:
%my_global_var=0
exit
When the driver ends, it will close all of the files opened by your program which triggers a call to the clean_up procedure when the memory file is closed.
Important Links
Community Hubs
Discussion Forums
Groups
Community News
Popular Tags
ION Connect
ION Workflow
ION API Gateway
Syteline Development
CPQ Discussion Ask a Colleague
Infor Data Fabric
Infor Document Management (IDM)
LN Development
FAQs, How-To, and Best Practices
API Usage