View previous topic :: View next topic
|
Author |
Message |
toughhou
New User
Joined: 21 Jan 2010 Posts: 5 Location: China
|
|
|
|
Hi All, When I tried to run a dynamic sql statment program, I got some problems. Anyone can help with it?
B210-DELETE-CUST.
MOVE SPACE TO DEL-STMT-TEXT.
STRING 'DELETE FROM TOUGH.' TABLE-NAME
'WHERE INVNO= ''' INVNO ''''
DELIMITED BY SIZE
INTO DEL-STMT-TEXT.
DISPLAY 'SQL: ' DEL-STMT-TEXT.
EXEC SQL
EXECUTE IMMEDIATE :DEL-STMT
END-EXEC.
===========(1)=================
EXEC SQL
COMMIT
END-EXEC.
===========(1)=================
If the program stop run without commit(i mark (1) here) after execution of the above sql statment, the sqlcode=00000010M.Anyone can explain about why I should commit manually. I remember that the program can commit automatically. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you don't show any code where you are checking the SQLCODE after invoking DB2 to process your SQL.
so, not sure what sql statement is receiving the -104.
relying on auto commit in batch is poor programming.
in cics, normally you use syncpoints and at task termination,
db2 is invoked for the commit. |
|
Back to top |
|
|
toughhou
New User
Joined: 21 Jan 2010 Posts: 5 Location: China
|
|
|
|
dbzTHEdinosauer wrote: |
you don't show any code where you are checking the SQLCODE after invoking DB2 to process your SQL.
so, not sure what sql statement is receiving the -104.
relying on auto commit in batch is poor programming.
in cics, normally you use syncpoints and at task termination,
db2 is invoked for the commit. |
toughhou wrote: |
Hi All, When I tried to run a dynamic sql statment program, I got some problems. Anyone can help with it?
B210-DELETE-CUST.
MOVE SPACE TO DEL-STMT-TEXT.
STRING 'DELETE FROM TOUGH.' TABLE-NAME
'WHERE INVNO= ''' INVNO ''''
DELIMITED BY SIZE
INTO DEL-STMT-TEXT.
DISPLAY 'SQL: ' DEL-STMT-TEXT.
EXEC SQL
EXECUTE IMMEDIATE :DEL-STMT
END-EXEC.
===========(1)=================
EXEC SQL
COMMIT
END-EXEC.
===========(1)=================
If the program stop run without commit(i mark (1) here) after execution of the above sql statment, the sqlcode=00000010M.Anyone can explain about why I should commit manually. I remember that the program can commit automatically. |
Here you see, if I didn't code the commit which I marked between "===========(1)============", it will give a sqlcode of 00000010M. But you told me it's -104, why 00000010M stands for -104? Could you explain? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Please refer to this Sticky which answers your question. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10876 Location: italy
|
|
|
|
Quote: |
why 00000010M stands for -104? Could you explain? |
pretty basic concept
the sign zones generally used are C and F for positive numbers D for negatives
so
Code: |
x'c0c1c2c3c4c5c6c7c8c9'
x'f0f1f2f3f4f5f6f7f8f9' |
are the hex representations for positive signed zoned numbers
Code: |
x'd0d1d2d3d4d5d6d7d8d9' |
are the same for negative signed zoned numbers
up to you to understand the why ! |
|
Back to top |
|
|
|