PxPlus User Forum

Main Board => Discussions => Language => Topic started by: James Zukowski on April 23, 2026, 01:25:12 PM

Title: DEF ENV and BEGIN
Post by: James Zukowski on April 23, 2026, 01:25:12 PM
We're looking at the DEF ENV directive to set some things up as we start our application. Doing some very preliminary tests, it seems as though the BEGIN directive clears out anything that had been set. I thought this was setting the Windows Environment variables for the session, which I would think would be session-permanent.
Is BEGIN supposed to clear these out?
Title: Re: DEF ENV and BEGIN
Post by: James Zukowski on April 29, 2026, 04:40:32 PM
Any insights?
Title: Re: DEF ENV and BEGIN
Post by: Devon Austen on April 30, 2026, 08:32:06 AM
I just tried it and the begin directive does not clear the env vars set via def env() in my test

->def env("pxplus_var")="Hello"
->?env("pxplus_var")
Hello
->begin
->?env("pxplus_var")
Hello

Looking at the code I can also confirm it can't.

Maybe something else is happening that is starting a new process?
Title: Re: DEF ENV and BEGIN
Post by: James Zukowski on April 30, 2026, 09:06:58 AM
Could it be a difference between Linux-based and Windows-based systems? I attached what I got with your test.
Title: Re: DEF ENV and BEGIN
Post by: Devon Austen on April 30, 2026, 09:59:45 AM
I just tried locally from Windows and Linux and then via WindX to a Windows and Linux server. All maintained the env var after the begin.

I was testing in PxPlus 2025 Update 1.

What version are you running?
Title: Re: DEF ENV and BEGIN
Post by: James Zukowski on April 30, 2026, 10:03:08 AM
Tested using v22.00.0002

We'll be updating to 22.01 shortly.
Title: Re: DEF ENV and BEGIN
Post by: Devon Austen on April 30, 2026, 10:19:25 AM
I just tested in that version via local/windx and win/linux and it never clears it either.

Do you have something in your START_UP that could be causing issues?

From our side we are calling a OS system call to set the env var and only ever call that when DEF ENV() is used. The only way to unset it is to call DEF ENV() again for the same name and with no value. That or close the process.

Maybe some how your system is closing the process?
Title: Re: DEF ENV and BEGIN
Post by: James Zukowski on April 30, 2026, 10:30:37 AM
The screen snip I included is exactly the process I went through. There were no other actions between the steps. This is being launched out of Connection Manager. The v22.01 version should be installed in the next couple of days, so I'll re-test it when it gets here.
Title: Re: DEF ENV and BEGIN
Post by: Devon Austen on April 30, 2026, 12:03:31 PM
The code didn't change for this between those versions and I tested with version 22.00.0002 here and the begin did not clear env vars for me.

This means likely there is something in your START_UP or INI file that is different between your test and mine.

What WindX type are you using Simple CS? What host OS are you using?
Title: Re: DEF ENV and BEGIN
Post by: James Zukowski on April 30, 2026, 03:03:04 PM
These parameters are set in START_UP and our lead program sequence:

SET_PARAM 'KF'=2
SET_PARAM '+A'=12
SET_PARAM 'BY'=0
SET_PARAM -'D0'
SET_PARAM 'FF'=3
SET_PARAM 'OP'
SET_PARAM 'XT'=0
SET_PARAM 'F,'
SET_PARAM 'XF'
SET_PARAM 'NE'
SET_PARAM '+M'
SET_PARAM -'SB'

SET_PARAM 'PQ'=PRM('PQ')

EXECUTE "[WDX]SET_PARAM 'TC'=3"
SET_PARAM 'TC'=3

There is no server-side pxplus.ini in use. The Windows-side pxplus.ini file contains:

[Font]
Points=19
Charset=0
Name=Lucida Console
[WindowFrame]
TypeSizeLoc=1,902,594,200,131

After exiting to command mode, I entered the statements shown in the previous example.

The PxPlus version has been upgraded to 22.01 and it still produces the same results.

The server is running RHEL 9.7
Client is Windows 11 Enterprise 10.0.26100 Build 26100

Many aspects of the PC are managed by the company. Would there be any restrictions on this behavior coming from there? Would there be any sort of "memory protection" prohibiting this?
Title: Re: DEF ENV and BEGIN
Post by: Devon Austen on May 01, 2026, 11:02:09 AM
I was able to reproduce the issue on a RHEL9 pxplus running locally (i.e. no windx).

With that I was able to find and fix the issue. The issue only affected linux/unix.

PxPlus 2026 should include the fix.
Title: Re: DEF ENV and BEGIN
Post by: James Zukowski on May 01, 2026, 05:07:25 PM
That's a good news/bad news situation...
Great that you found it and could fix it. Unfortunately, our company policy it to stay 1 major release back, so we won't be able to use that until next year at the earliest (unless you folks provide another interim release for v22...days before your v23 release...).