DB2 Syntx giving trouble in Server routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
SachinCho
Participant
Posts: 45
Joined: Thu Jan 14, 2010 1:23 am
Location: Pune

DB2 Syntx giving trouble in Server routine

Post by SachinCho »

Hi All,
I have a DS Server routine where I am trying to insert a record in DB2 table. Below is the routine code used and after that error I am getting is posted. Somehow those single quotes are not appearing for varchar fields and its giving this error. Any inputs how to correct this syntax. Have tried lot options

QueryCmd = "db2 -mv " : "'Insert into STG.JOB_CNTL(CDC_STG_BATCH_ID, JOB_NAME, STATUS) Values ( ":v_BatchId:",":jobname:",'Success')';"
Call DSExecute('UNIX',QueryCmd,Output,ReturnVal)


seq_routine..JobControl (DB2INSERT): THE return value of query is :Insert into STG.JOB_CNTL(CDC_STG_BATCH_ID, JOB_NAME, STATUS) Values ( 1111,test_11dec,Success)
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0206N "TEST_11DEC" is not valid in the context where it is used.
SQLSTATE=42703
Sachin C
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

My guess is that you need single quotes around the value TEST_11DEC

For example, and assuming that this is a value for the second parameter in the Insert statement (jobname):
QueryCmd = "db2 -mv " : "'Insert into STG.JOB_CNTL(CDC_STG_BATCH_ID, JOB_NAME, STATUS) Values ( ":v_BatchId:", '":jobname:"' ,'Success')';"
Call DSExecute('UNIX',QueryCmd,Output,ReturnVal)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply