共用方式為


如何使用 REOverride 來指定遠端環境

若要以程式設計方式指定 RE,應用程式會使用 Managed 內容專案。 內容屬性必須從設計工具中的 方法設定為 true。

下列 Visual Basic 程式碼示範在應用程式中幾乎建立 RE 的範例。

' You must set the following references in your project:   
'    Microsoft.HostIntegration.TI.ClientContext.dll  
'    Microsoft.HostIntegration.TI.Globals.dll  
  
Imports Microsoft.HostIntegration.TI  
  
 Dim TIContext As New ClientContext  
 Dim DynamicRE As ELMLinkRemoteEnvironment  
  
  DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.ELMLink, "MyRE")  
   DynamicRE.IPAddress = SystemAddress  
   DynamicRE.TCPPorts = PortNumber  
   TIContext.DynamicRE = DynamicRE  
  
Obj.Method1 parm1, parm2, parm3, TIContext  
  

下列 Visual Basic 程式碼示範使用 MSHMIRS 的 HTTP 範例。

Dim DynamicRE As HTTPLinkRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.HttpLink, "MyRE")  
DynamicRE.IPAddress = SystemAddress  
DynamicRE.HttpPort = PortNumber  
DynamicRE.MirrorProgramName = "MSHMIRS"  
DynamicRE.AliasTransactionId = "CWBA"  
TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示 HTTP 使用者資料的範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As HTTPUserDataRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.HttpUserData, "MyRE")  
DynamicRE.IPAddress = SystemAddress  
DynamicRE.HttpPort = PortNumber  
DynamicRE.AliasTransactionId = "CWBA"  
TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示 CICS Link 的範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As SNALinkRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.SNALink, "MyRE")  
DynamicRE.LocalLUName = LocalLUName  
DynamicRE.RemoteLUName = RemoteLUName  
DynamicRE.ModeName = Mode  
TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示 CICS LU6.2 使用者資料的範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As SNAUserDataRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.SNAUserData, "MyRE")  
DynamicRE.LocalLUName = LocalLUName  
DynamicRE.RemoteLUName = RemoteLUName  
DynamicRE.ModeName = Mode  
  
TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示 IMS LU 6.2 的範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As SNAUserDataRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.IMSLU62, "MyRE")  
DynamicRE.LocalLUName = LocalLUName  
DynamicRE.RemoteLUName = RemoteLUName  
DynamicRE.ModeName = Mode  
TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示 ELM Link 的範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As ELMLinkRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.ELMLink, "MyRE")  
DynamicRE.IPAddress = SystemAddress  
DynamicRE.TCPPorts = PortNumber  
TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示具有安全性的 TRM Link 範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As TRMLinkRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.TRMLink, "MyRE")  
DynamicRE.IPAddress = SystemAddress  
DynamicRE.TCPPorts = PortNumber  
DynamicRE.Security = RemoteEnvironmentSecurity.User  
TIContext.DynamicRE = DynamicRE  
TIContext.User = "UserId"  
TIContext.Password = "Password"  
  

下列 Visual Basic 程式碼顯示具有安全性的 TRM 使用者資料範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As TRMUserDataRemoteEnvironment  
  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.TRMUserData, "MyRE")  
DynamicRE.IPAddress = SystemAddress  
DynamicRE.TCPPorts = PortNumber  
DynamicRE.Security = RemoteEnvironmentSecurity.User  
TIContext.User = "UserId"  
TIContext.Password = "Password"  
TIContext.TransactionId = "CICS Transaction name"  
TIContext.DynamicRE = DynamicRE  

下列 Visual Basic 程式碼顯示沒有安全性的 IMS Connect 範例,請結束HWSIMSO0。

Dim TIContext As New ClientContext  
 Dim DynamicRE As IMSConnectRemoteEnvironment  
  
 DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.IMSConnect, "MyRE")  
 DynamicRE.IPAddress = SystemAddress  
 DynamicRE.TCPPorts = PortNumber  
 DynamicRE.ItocExitName = "*IRMREQ*"  
 DynamicRE.OtmaSystemId = "IMS system ID"  
 TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示具有安全性的 IMS Connect 範例、結束HWSIMSO1。

Dim TIContext As New ClientContext  
Dim DynamicRE As IMSConnectRemoteEnvironment  
  
 DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.IMSConnect, "MyRE")  
 DynamicRE.IPAddress = SystemAddress  
 DynamicRE.TCPPorts = PortNumber  
 DynamicRE.ItocExitName = "*IRMRE1*"  
 DynamicRE.OtmaSystemId = "IMS system ID"  
 DynamicRE.Security = RemoteEnvironmentSecurity.Off Or RemoteEnvironmentSecurity.ImsHWS01SecurityExit  
 TIContext.DynamicRE = DynamicRE  
  

下列 Visual Basic 程式碼顯示具有安全性和程式庫名稱的 OS 400 範例。

Dim TIContext As New ClientContext  
Dim DynamicRE As DPCRemoteEnvironment  
DynamicRE = RemoteEnvironmentClassFactory.MakeRemoteEnvironment(DynamicRemoteEnvironmentTypes.DistributedProgramCall, "MyRE")  
DynamicRE.IPAddress = SystemAddress  
DynamicRE.TCPPorts = PortNumber  
DynamicRE.Security = RemoteEnvironmentSecurity.User  
TIContext.User = "UserID"  
TIContext.Password = "Password"  
TIContext.LibraryName = "Library Name"  
TIContext.DynamicRE = DynamicRE  
  

另請參閱

以程式設計方式指定遠端環境