Session:parameter

kirsch59

Member
I have a program that I run as a batch program (command line) using the -param option. I would like to use the same program in a real-time application. Is there anyway I can set SESSION:pARAMETER before I call the program?

Thanks
Mark
 

TomBascom

Curmudgeon
Not after a session starts. SESSION:pARAMETER is not writable. It can only be set at startup via -param.

You could break it into two parts and write a "wrapper" program that extracts the needed information from session:parameter and turns it into a regular parameter and then call the program using normal parameters from both your batch and your online procedure.
 

sdjensen

Member
Test if you are running in batch-mode if so and the session parameters are not empty use them otherwise update them using set.

Code:
[SIZE=2][COLOR=#7f0055][COLOR=#000000]procedure _GetSessParm:[/COLOR][/COLOR][/SIZE][COLOR=#7f0055]
[SIZE=2][COLOR=#7f0055]  define input parameter Parmid as character  no-undo.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]  define output parameter ParmVal as character  no-undo.[/COLOR][/SIZE]
[SIZE=2][COLOR=#7f0055]  define variable idx as integer no-undo.[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]  if session:parameter = ''[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]     or session:parameter = ?[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]     or not session:batch-mode then[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]  do:[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]     display parmid format "x(20)".[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]     set parmval format "x(20)".[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]     return.[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]  end.[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]  idx = lookup(ParmId,session:parameter,'^').[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]  if idx = 0 then[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]     parmval = ?.[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]  else[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]     parmval = entry(idx + 1, session:parameter, '^').[/COLOR][/SIZE]
[SIZE=2][COLOR=#000000]end procedure.[/COLOR][/SIZE]
 
[/COLOR]
 
Top