IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Are double quotes not accepted in DB2


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ysuryawanshi_mcs
Warnings : 1

New User


Joined: 25 Mar 2006
Posts: 15
Location: pune(India)

PostPosted: Fri Mar 24, 2006 5:43 pm
Reply with quote

Hi

I was trying to execute a COBOL-DB2 program where in I was executing an SQL statement:

SELECT EMPNO,EMPNAME,EMPSAL.EMPDEPT

INTO :RAD-EMPNO,:RAD-EMPNAME, :RAD-EMPSAL, :RAD-EMPDEPT

FROM EMPLOYEE_MASTER

WHERE DEPTNO = ?D001?


Where RAD-EMPNO,RAD-EMPNAME,RAD-EMPSAL and RAD-EMPDEPT are the DCLGEN variables. DEPTNO is the primary key.

The above SQL statement gives an error at Precompilation time that the column is not specified in the table specified.

The solution is that we need to give the dept value in double quotes and not in single quotes as shown below


SELECT EMPNO,EMPNAME,EMPSAL.EMPDEPT

INTO :RAD-EMPNO,:RAD-EMPNAME, :RAD-EMPSAL, :RAD-EMPDEPT

FROM EMPLOYEE_MASTER

WHERE DEPTNO = ?D001?



So now my query is that, is there any Precompiler option to accept single apostrophes?
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Mon Mar 27, 2006 8:15 am
Reply with quote

ysuryawanshi_mcs,

This does not answer your specific question, but how about moving the departmant # "D001" to a working storage area first.

Code:


    05  WS-DEPT              PIC X(4).


    MOVE 'D001'     to WS-DEPT.

    SELECT EMPNO,EMPNAME,EMPSAL.EMPDEPT
    INTO :RAD-EMPNO,:RAD-EMPNAME, :RAD-EMPSAL, :RAD-EMPDEPT
    FROM EMPLOYEE_MASTER
    WHERE DEPTNO = :WS-DEPT



Dave
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Help in extracting data between doubl... DFSORT/ICETOOL 5
No new posts DB2 - CHAR9 is not accepted by IBM S... DB2 4
No new posts Translating Quotes CLIST & REXX 6
No new posts Strings with double quotes having pro... All Other Mainframe Topics 11
No new posts To change double quotes into csv read... COBOL Programming 3
Search our Forums:

Back to Top