[z/OS]

외부 주소 공간 또는 서브시스템에 아웃바운드 API 사용

아웃바운드 API와 외부 주소 공간 또는 서브시스템 간의 상호작용을 작성하려면 이 태스크를 사용하십시오.

시작하기 전에

최적화된 로컬 어댑터를 사용하여 z/OS®용 WebSphere® Application Server 애플리케이션에서 외부 주소 공간 또는 서브시스템을 호출 주제에 설명된 대로, 외부 주소 공간 또는 서브시스템과의 연결을 설정하십시오.

프로시저

  1. 옵션: 트랜잭션을 지원하는 CICS®(Customer Information Control System) 서버 태스크를 사용 중인 경우 자원 관리자 로컬 트랜잭션(RMLT)을 시작하십시오. 트랜잭션을 지원하는 CICS 서버 태스크를 사용하려면 서버 태스크를 시작할 때 키워드 TXN=Y이 사용됩니다. RMLT를 시작하여 단일 작업 단위에서 여러 상호작용을 캡슐화할 수 있습니다. Java™ EE(Java Enterprise Edition) 애플리케이션 컴포넌트가 글로벌 트랜잭션에서 실행 중이지 않고, LocalTransaction 경계가 애플리케이션 배치 디스크립터에서 애플리케이션으로 설정되어 있어야 합니다. 다음 예제는 배치 디스크립터가 변경된 후 LocalTransaction 오브젝트를 사용하여 로컬 트랜잭션을 시작하는 방법을 보여줍니다.
    LocalTransaction lt = con.getLocalTransaction();
    lt.begin();

    애플리케이션 배치 디스크립터에서 LocalTransaction 설정을 변경하는 방법에 대한 자세한 정보는 트랜잭션 배치 속성 구성 주제의 내용을 참조하십시오.

    Java EE 애플리케이션 컴포넌트가 LocalTransaction 경계, ContainerAtBoundary를 사용하도록 구성된 경우에는 연결을 얻으면 RMLT에서 연결이 자동으로 확보됩니다. 이 연결을 사용할 때 수행되는 작업은 Java EE 애플리케이션 컴포넌트가 종료될 때 자동으로 완료됩니다.

    Java EE 애플리케이션 컴포넌트가 글로벌 트랜잭션에서 시작하고 있으면 연결을 얻을 때 글로벌 트랜잭션에서 커넥터가 자동으로 확보됩니다. 이 연결을 사용할 때 수행되는 작업은 Java EE 애플리케이션 컴포넌트가 종료될 때 자동으로 완료됩니다. 연결을 얻는 데 사용되는 ConnectionFactory 오브젝트는 RegisterName 사용자 정의 특성이 글로벌 트랜잭션에 참여하도록 설정되어 있어야 합니다.

  2. 연결 오브젝트를 사용하여 상호작용을 작성하십시오. 예를 들어, 다음과 같습니다.
    Interaction int = con.createInteraction();
  3. InteractionSpecImpl 오브젝트를 작성하고 상호작용 스펙에 서비스 이름을 설정하십시오. 서비스 이름은 원격 시스템에서 호출하려는 메소드 또는 기능의 이름을 설명합니다. 서비스 이름은 원격 시스템이 호스트 또는 요청 수신 API 중 하나를 호출할 때 또는 CICS(Customer Information Control System)를 사용할 때 서버 태스크가 CICS 내에서 시작할 프로그램 이름인 경우에 제공됩니다. 예를 들어, 다음과 같습니다.
    InteractionSpecImpl isi = new InteractionSpecImpl();
    isi.setServiceName("MYSERVICE");
    주의: OTMA에서 최적화된 로컬 어댑터를 사용할 때에는 서비스 이름이 정의되지 않고 대상 IMS™ 트랜잭션이 메시지 스트림에 지정됩니다. 서비스 이름은 설정 가능하지만 OTMA의 최적화된 로컬 어댑터 호출에는 사용되지 않습니다. 자세한 정보는 OTMA에서 최적화된 로컬 어댑터로 기존 IMS 트랜잭션 호출 주제의 내용을 참조하십시오.
  4. 작성한 상호작용 스펙을 사용하여 상호작용을 실행하십시오. 예를 들어, 다음과 같습니다.
    int.execute(isi, null);
  5. 애플리케이션이 RMLT를 사용한 경우에는 마지막 상호작용이 완료되면 작업을 커미트 또는 백아웃하십시오. LocalTransaction 오브젝트에 커미트 또는 롤백 메소드를 사용하십시오. 예를 들어, 다음과 같습니다.
    lt.commit();

결과

외부 주소 공간 또는 서브시스템과의 상호작용이 완료되었습니다.
주의: RMLT 또는 글로벌 트랜잭션을 사용할 때 CICS 애플리케이션이 RMLT 또는 글로벌 트랜잭션 중 동기점을 발행하면 서버 태스크가 동기점 중에 BBOX 이상 종료를 발행합니다. 이로 인해 동기점이 실패하고 CICS에서 ASPx 이상 종료가 생성됩니다. CICS 애플리케이션은 WebSphere Application Server가 LocalTransaction 오브젝트에 커미트 또는 롤백 메소드를 호출하거나 Java EE 애플리케이션 컴포넌트를 완료시켜서 동기점 조작을 발행할 때까지 기다려야 합니다.
주의: CICS 트랜잭션이 실행할 수 있는 최대 시간을 정의하려면 글로벌 트랜잭션 컨텍스트 또는 RMLT를 WebSphere에서 CICS로 가져올 때, CICS 링크 서버 링크 태스크를 시작하는 데 사용되는 트랜잭션 정의의 OTSTIMEOUT 매개변수값을 수정하십시오. 기본적으로 트랜잭션 이름은 BBO#입니다. CICS 트랜잭션 런타임이 OTSTIMEOUT 매개변수에 지정된 시간을 초과하는 경우 CICS 트랜잭션을 실행 중인 CICS 태스크가 이상 종료되어 전체 글로벌 트랜잭션 또는 RMLT가 롤백됩니다. 트랜잭션 정의에 OTSTIMEOUT 매개변수를 코딩하는 방법에 대한 정보는 z/OS용 CICS Transaction Server 자원 정의 안내서의 내용을 참조하십시오.

Java EE 애플리케이션 컴포넌트가 RMLT 또는 글로벌 트랜잭션에 참여 중이며 애플리케이션이 일괄처리 프로그램 또는 키워드 TXN=N으로 시작된 CICS 링크 서버와 통신 중이면, 최적화된 로컬 어댑터 연결이 대상 프로그램에 연결을 설정할 수 없습니다. 대상 프로그램이 Java EE 애플리케이션에 필요한 트랜잭션 기능을 제공할 수 없습니다. 마이너 코드 0xC9C24C3B의 예외가 표시됩니다. 이 코드는 대상 등록 이름이 있지만 트랜잭션에 사용되지 않음을 표시합니다. 키워드 TXN=Y로 사용 가능하게 된 CICS 링크 서버만 z/OS용 WebSphere Application Server로부터의 트랜잭션을 전파를 지원할 수 있습니다.

다음 메소드는 바이트 배열(byte[])로 입력 및 출력 데이터와의 상호작용을 시작하는 방법을 보여줍니다.

public byte[] driveInteraction(javax.resource.cci.ConnectionFactory cf,
javax.resource.cci.Connection con,byte[] inputDataBytes),throws javax.resource.ResourceException
	{
	// Create an interaction using the optimized local adapter connection
		 javax.resource.cci.Interaction i = con.createInteraction();
	// The InteractionSpec describes the service we want to call
		 com.ibm.websphere.ola.InteractionSpecImpl isi = new com.ibm.websphere.ola.InteractionSpecImpl();
		 isi.setServiceName("MYSERVICE");
	// The input data is specified using an IndexedRecord.  The first
	// slot in the indexed record contains the input data bytes.
		 javax.resource.cci.RecordFactory rf = cf.getRecordFactory();
		 javax.resource.cci.IndexedRecord ir = rf.createIndexedRecord(null);
		 ir.add(inputDataBytes);
		 		 
	// The interaction returns another IndexedRecord, whose first
	// slot contains the output data bytes.
		 javax.resource.cci.Record or = i.execute(isi, ir);
		 byte[] outputDataBytes = null;
		 		 
		 if (or != null)
		 {
		 		 outputDataBytes = (byte[])((javax.resource.cci.IndexedRecord)or).get(0);
		 }
		 		 
	// Return the output data to the caller 
			return outputDataBytes;
		 }

다음 메소드는 Rational® Application Developer 생성 카피북 레코드 오브젝트를 사용하여 상호작용을 시작하는 방법을 보여줍니다.

/**
	* An example of driving an optimized local adapter interaction, using a Rational 
  * Application Developer copybook mapping class as input (inputRecord) and receiving
  * a Rational Application Developer copybook mapping as output.
	*/		 
			public javax.resource.cci.Record driveInteraction(
		 	javax.resource.cci.Connection con,
		 	javax.resource.cci.Record inputRecord)
		 	throws javax.resource.ResourceException
	  {
	// Create an interaction using the OLA connection
		 	javax.resource.cci.Interaction i = con.createInteraction();
	// The InteractionSpec describes the service we want to call com.ibm.websphere.ola.InteractionSpecImpl isi = 
		 new com.ibm.websphere.ola.InteractionSpecImpl();
		 isi.setServiceName("MYSERVICE");
	// The Rational Application Developer generated copybook implements 
	// javax.resource.cci.Record and can be passed directly to the interaction.
	// The interaction returns an IndexedRecord, whose first slot contains 
  // the output data bytes.
		 	javax.resource.cci.Record or = i.execute(isi, inputRecord);
		 	javax.resource.cci.Record outputRecord = null;
		 	if (or != null)
		 {
	// In this example, RADGeneratedOutputType is the name of the Rational Application Developer
  // generated copybook mapping class.
		 	outputRecord = new RADGeneratedOutputType();
 // The output bytes are stored in the output record returned on the
 // interaction, which is an IndexedRecord.
		 byte[] outputDataBytes = 
     (byte[])((javax.resource.cci.IndexedRecord)or).get(0);
		 		 		 
 // To convert the output bytes to another Rational Application Developer generated copybook, 
 // call the setBytes(byte[]) method of that class.  The class will 
 // implement the  com.ibm.etools.marshall.RecordBytes interface.
		 ((com.ibm.etools.marshall.RecordBytes)outputRecord)
        .setBytes(outputDataBytes);
		 }
		 		 
// Return the output data to the caller
		 		 return outputRecord;
		 }

주제 유형을 표시하는 아이콘 태스크 주제



시간소인 아이콘 마지막 업데이트 날짜: last_date
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=tdat_useoutboundconnection
파일 이름:tdat_useoutboundconnection.html