Highlighted
Valued Contributor.
Valued Contributor.
332 views

HPSM acessing system variables

Hi,

I'm trying to have code with diferent behaviour beetween production and development so I want to build it dinamicly based for example in system environment variables.

How can i do that?

I give one example... 

I have a structed in filesystem  that starts with ...\PRD\.... (in production) anda ...\QA\...  (quality)   if I put one environment variable with PRD (in production) ; QA(in quality) i can write the code based on that... and when I do the backup/restore or a copy beetwen system they are allways with the behaviour that I desire.

Anyone?

Best Regards,

HJ

0 Likes
4 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: HPSM acessing system variables

We created a Global Variable on the login.DEFAULT format control. We then can have the code check the value of the Global Variable to see whether the environment is prod or non-prod.

Initial Expressions:

$non.prod.servers={"xxx.xx.x.xx", "xxx.xxx.xx.xxx", "xx.xx.x.xxx"}  <---IP Addresses of non-prod app servers

Calculations:
Add:  true
Calculation:  $servinfo=sysinfo.get("ServerNetAddress");if (index($servinfo, $non.prod.servers)>0) then ($G.prod=false) else ($G.prod=true)

 

 

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: HPSM acessing system variables

Spoiler
 

Another option is create a simple environment table that stores all variables related to that specific environment and retrieve this information at execution time. So you can have your code the same in all environments you have having only diferent records in this environment table. 

Something like :

Key                 | Value

environment | P

logPath          | ...\PRD\,...

Regards,
Breno Abreu

If you feel this was helpful please click the KUDOS! thumb below!
0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: HPSM acessing system variables

Hi..

This dosn't work because we make... copy from all production environment database to quality and that table will be lost.

Best Regards.

0 Likes
Highlighted
Valued Contributor.
Valued Contributor.

Re: HPSM acessing system variables

Thanks... I think this can be a solution...

I will try

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.