简体   繁体   中英

issues in executing as400 command from SSIS execute sql task

I am working on an ssis package to process data from text file into as400 system. In one of the steps, i have to create a copy of an existing file object in iseries and i am executing the below command from execute sql task.

{CALL QSYS.QCMDEXC('CRTDUPOBJ OBJ(CKFMTWRK) FROMLIB(MYWRKLIB) OBJTYPE(*FILE) TOLIB(MYWRKLIB) NEWOBJ(CKFMTWRKPN) DATA(*NO)',0000000101.00000)}

This command works fine when i run it from the IBM Personal Communications terminal but throws below error when i do it from SSIS package.

[Execute SQL Task] Error: Executing the query "CALL QSYS.QCMDEXC('CRTDUPOBJ OBJ(CKFMTWRK) FROMLIB..." failed with the following error: "Routine *N in *N not found with specified parameters. SQLSTATE: 42884, SQLCODE: -440". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Further information on my environment:

I'm using sql server data tools 2015. I've established the connection to as400 using Microsoft OLEDB provider for DB2. I have sufficient permissions on the server (i guess, coz i am able to execute the commands from the terminal)

This is my first ever with as400 and I am stuck here in this step. I tried looking up online but there is nothing much that could help me in resolving this.

Any suggestions/help on this would be much appreciated.

Thanks. Dvr

You are trying to perform AS/400 OS level command from a SQL environment (SSIS) which is not correct. QCMDEXEC is AS/400 command line interpreter while CRTDUPOBJ is creation of an identical object from the source with the option to duplicate its data as well.

Personal Communication terminal is fine cos you think you are using SQL service but actually not. It's AS400 command.

End up, you better do it over AS/400 terminal for duplicating object. Just use

CRTDUPOBJ OBJ(CKFMTWRK) FROMLIB(MYWRKLIB) OBJTYPE(*FILE) TOLIB(MYWRKLIB) NEWOBJ(CKFMTWRKPN) DATA(*NO)

The last keyword DATA(*NO) means create the object only but not the data, so you will get an empty file after completion.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM