CL 명령어 실행 (ASP)


  1. Send Message Source
					
      Set Cnn=Server.CreateObject("ADODB.Connection")
      Set Cmd=Server.CreateObject("ADODB.Command")
      strCnn = "PROVIDER=IBMDA400;Data Source=yourDSN;"
      With Cnn
         .ConnectionString = strCnn
         .CursorLocation = adUseClient
         .Open
      End With

      Set Cmd.ActiveConnection = Cnn
      Cmd.CommandType = adCmdText
      Cmd.CommandText = "{{qsys/sndbrkmsg msg('" & Request("in_msg") & "') TOMSGQ(" & Request("in_wst") & ")}}"
      Cmd.Execute

      Response.Write "Message : 메세지 전송 완료 !!!"

      Cnn.Close
      set Cmd = nothing
      set Cnn = nothing

  2. 주요 부분 설명

      1) strCnn = "PROVIDER=IBMDA400;Data Source=yourDSN;"
            - yourDSN을 [ODBC 관리자]에서 설정한 이름으로 변경할 것
            - 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' 형태를 이용하여야 한다

  3. Error Message

      1) CWBC01003 - Winsock error. function returned 11001, YOURDSN
            - [ODBC 관리자]에서 설정한 DSN 이름이 AS/400 시스템명과 다른 경우
            - DSPNETA 명령어를 실행하면 시스템명을 알수 있음
     
      2) IBMDA400 Command error '80004005', CPF0006 - Errors occurred in command. 
            - 해당 명령어에 대한 사용권한이 없는 경우
            - 시스템관리자에게 문의하여 사용권한을 얻은 후 재시도

  4. 참  조

      1) 전체소스는 ASP 파일이므로 우측의 링크를 '다른이름으로 대상저장' 하세요  [Source Down]

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