Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Execute command on db2/400 fron Sequel Server 2005

Status
Not open for further replies.

snufse1

Programmer
Nov 14, 2008
66
0
0
US
From Sequel Server 2005 I am trying to issue a command to db2/400 using linked server:

exec('call qsys/qcmdexc('OVRDBF FILE(F55125) TOFILE(VGIPRDDTA/F55125) MBR(CO55PC) OVRSCOPE(*JOB)', 0000000071.00000)') at AS400SRV_MSDASQL

Getting syntax error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'OVRDBF'.

The connection works and I have tested this using below example "exec('Select * from vgiprddta.F55125.CO55PC') at AS400SRV_MSDASQL

Any ideas?

 
The program qsys/qcmdexc has 2 parameters:
1. The command
'OVRDBF FILE(F55125) TOFILE(VGIPRDDTA/F55125) MBR(CO55PC) OVRSCOPE(*JOB)'
2. the length of command
0000000071.00000

These parameters should not be separated by comma but by a space.

Try this in your exec():
Code:
CALL PGM(qsys/qcmdexc) PARM('OVRDBF FILE(F55125) TOFILE(VGIPRDDTA/F55125) MBR(CO55PC) OVRSCOPE(*JOB)' 0000000071.00000)
 
Getting syntax error on

CALL PGM(qsys/qcmdexc) PARM('OVRDBF FILE(F55125) TOFILE(VGIPRDDTA/F55125) MBR(CO55PC) OVRSCOPE(*JOB)' 0000000071.00000)

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'qsys'.

 
Disregard previous post. Tried this:

exec('CALL PGM(qsys/qcmdexc) PARM('OVRDBF FILE(F55125) TOFILE(VGIPRDDTA/F55125) MBR(CO55PC) OVRSCOPE(*JOB)' 0000000071.00000)') at AS400SRV_MSDASQL

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'OVRDBF'.



 
Got it working this way:

exec('CREATE ALIAS QTEMP.F55125 FOR VGIPRDDTA.F55125 (CO55PC)') at AS400SRV_MSDASQL
exec('Select * from QTEMP.F55125') at AS400SRV_MSDASQL

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top