COBOL 프로그램 실행 (ASP)


  1. Connection String 이용
					
       Set Cnn=Server.CreateObject("ADODB.Connection")

       strCnn = "PROVIDER=IBMDA400;Data Source=yourDSN;USER ID=yourID;PASSWORD=yourPWD"
       Cnn.Open strCnn
   
       strCmd = "{{CALL PGM(yourLIB/yourPGM) PARM('yourPARM') }}"
       Cnn.Execute strCmd

       Cnn.Close
       set Cnn = nothing

  2. Command Object 이용
					
       Set Cnn=Server.CreateObject("ADODB.Connection")
       Set Cmd=Server.CreateObject("ADODB.Command")

       strCnn = "PROVIDER=IBMDA400;Data Source=yourDSN;USER ID=yourID;PASSWORD=yourPWD"
       Cnn.Open strCnn
   
       Set Cmd.ActiveConnection = Cnn
       Cmd.CommandType = adCmdText
       Cmd.CommandText = "{{CALL PGM(yourLIB/yourPGM) PARM('yourPARM') }}"
       Cmd.Execute 

       Cnn.Close
       Cmd.Close
       set Cmd = nothing
       set Cnn = nothing

  3. 주요 부분 설명

      1) strCnn = "PROVIDER=IBMDA400;Data Source=yourDSN;"
            - yourDSN을 [ODBC 관리자]에서 설정한 이름으로 변경할 것 (IP 사용 가능)
            - DSN 이름은 사용하는 AS/400 시스템명과 동일하게 설정할 것
            - AS/400 프로그램을 실행하기 위해서는 반드시 'IBMDA400' 사용

      2) Set Cmd.ActiveConnection = Cnn
            Command 오브젝트의 Connection을 지정하는 부분이다

      3) Cmd.CommandText = "{{qsys . . .
            - 실행할 AS/400 명령어를 Cmd 개체에 정하는 부분이다
            - AS/400 프로그램 실행은 반드시 '{{' 와 '}}'로 둘러 싼 후 실행하여야 한다
            - Naming Rule은 '*SYS' 형태를 이용하여야 한다


  4. 참  조

      - 참고자료 SC24-5183-00  AS/400 OLE DB Support