Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    iSM IFL for reading Environment variables

Read-Only Read-Only Topic
Go
Search
Notify
Tools
iSM IFL for reading Environment variables
 Login/Join
 
Member
posted
Hello,

Is there an iWay function in Service Manager 6.1.2 which can retrieve the value of a Windows System Environment variable?

Thanks.


iSM 616
iDM 7705
iDQC 802
WF 77
Windows 2008 Server
 
Posts: 29 | Registered: May 01, 2007Report This Post
Member
posted Hide Post
I don't think there is a function, but if you change your iSM startup script to include the variable in the java properties, like -Dwindir=%windir%, you might be able to use _sreg(windir).


iWay Service Manager (6.0.1 - patch.62627)
DMC Version 7 Release 7
 
Posts: 12 | Registered: January 24, 2011Report This Post
Member
posted Hide Post
Hi AK,

there is no direct function, but there's a _property() iFL... If you do

C:\> set > myvars.txt

You should be able to get the values from the file.

The easiest is probably to call the service that invokes OS commands:

Run OS Shell Command Service (com.ibi.agents.XDRunCmdAgent)

The command would be "cmd /C set" to get a list of all variables under /status/cmdoutput or "cmd /C set prompt" to get the value of the PROMPT variable....

<?xml version="1.0" encoding="UTF-8" ?>
<status>
	<command>cmd /C set prompt</command>
	<exitcode>0</exitcode>
	<cmdoutput>PROMPT=$P$G</cmdoutput>
</status>


Hope this helps!

Newbie.


--
WebFOCUS 8.2.03 on Linux
 
Posts: 8 | Location: Canada | Registered: March 23, 2010Report This Post
Virtuoso
posted Hide Post
I know nothing about Service Manager and iWay functions, but there is a WebFOCUS function, FGETENV, that is used to retrieve values from system environment variables. You could see if it works in iWay.

Syntax: How to Retrieve the Value of an Environment Variable

FGETENV(varlength, 'varname', outfieldlen, outfldformat);

where:

varlength=Integer  - Is the length of the environment variable name.

varname=Alphanumeric  - Is the name of the environment variable.

outfieldlen=Integer  - Is the length of the field in which the environment variable's value is stored.

outfldformat=Alphanumeric  - Is the format of the field in which the environment variable's value is stored.


WebFOCUS 7.7.05
 
Posts: 1213 | Location: Seattle, Washington - USA | Registered: October 22, 2007Report This Post
Member
posted Hide Post
WebFOCUS / iDM function FGETENV does not work in iSM.

One comment about FGETENV function in iDM is whenever the Windows environment variable value changes, iDM server has to be restarted to load the new value. If the server is not restarted the function always retrieves the old value. Looks like this function does not call the env var directly but rather calls the variables that are loaded in memory when the server is started.


iSM 616
iDM 7705
iDQC 802
WF 77
Windows 2008 Server
 
Posts: 29 | Registered: May 01, 2007Report This Post
Guru
posted Hide Post
I'm not sure your comment about FGETENV is quite correct; when you issue a set from a DOS prompt it's not going to affect the server running as a service or in its own DOS window.

However if you set an environment variable from withinthe running server, that would be fine. For example:

 -SET &RC= FPUTENV(9, 'IWAF_HOME', 7, 'C:\IWAF', 'I8');
-SET &IWH = FGETENV(9, 'IWAF_HOME', 20, 'A20');
-TYPE &IWH 


N/A
 
Posts: 397 | Location: New York City | Registered: May 03, 2007Report This Post
Virtuoso
posted Hide Post
Or you can just write one:

Code: FunctionNodeGetEnv.java
package com.ibi.funcs;
import com.ibi.edaqm.*;

public class FunctionNodeGetEnv extends FunctionNode {

	public FunctionNodeGetEnv() {
		super("GetEnv");
	}
	
	public FunctionNodeGetEnv(String name) {
		super("GetEnv");
	}
	
	String getTypeName() {
		return "GetEnv";
	}
	
	public int getMinParms() { 
		return 1; 
	}
	
	public int getMaxParms() { 
		return 1; 
	}

	public XDNode getDesc()	{
		try {
			String info =
				"<func name='_getenv' class='string'>" +
				"<desc>Get Environment Variable value.</desc>" +
				"<parm name='string' type='string' req='yes'>Enviornment variable to return</parm>" +
				"</func>";
			XDDocument d = new XDDocument(null,info);
			return d.getRoot();
		} catch (Exception e) {
			return null;
		}
	}
	
	private FunctionNode[] parms;
	
	public void optimize(XDManager manager, com.ibi.common.IXLogger logger) throws XDException	{
		super.optimize(manager,logger);
		parms = getParms();
	}
	
	public String getXValue(XDDocument doc, com.ibi.common.ISpecRegManager srm, com.ibi.common.IXLogger logger) throws XDException	{
		/* Initialize return string */
		String eValue = null;

		/* Ensure there is 1 arguments in the function call */
		if (parms.length != 1) {
			throw new XDFunctionException("_GetEnv",1,"Function requires min 1 argument.");
		}
		
		/* Retrieve the in bound arguments */
		String arg1 = parms[0].getXValue(doc, srm, logger);

		/* Get the environment variable */
		try{
			eValue = System.getenv(arg1);
		}catch (Exception e){
			throw new XDFunctionException("_GetEnv",1,"_getenv failed.");
		}

		/* return environment variable if available */
		return (eValue == null ? " " : eValue);
	}
}
  


Code: GetEnvRegister.java
package com.ibi.funcs;

public class GetEnvRegister implements com.ibi.common.IComponentRegister {
	public GetEnvRegister() {
	}

	public void register (com.ibi.common.IComponentManager cm) {
		cm.addFunction("_getenv","com.ibi.funcs.FunctionNodeGetEnv");
	}
	public void unregister (com.ibi.common.IComponentManager cm) {
	}
}  


Manifest:
Name: IXTEComponent
Register: com.ibi.funcs.GetEnvRegister
  


Usage:
 _getenv('temp') 


Returns:
 C:\DOCUME~1\dhagen\LOCALS~1\Temp 


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Gold member
posted Hide Post
I haven't tried this, but many thanks to dhagen for a top quality answer!


iWay 5.5 SMSP1 and 6.0.1 on Intel/Linux
 
Posts: 59 | Location: Birmingham, Blighty | Registered: October 30, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    iSM IFL for reading Environment variables

Copyright © 1996-2020 Information Builders