COBOL DB2 Compiler options



IBM's flagship relational database management system

COBOL DB2 Compiler options

Postby SMRAO123 » Wed Apr 16, 2014 5:03 pm

Hi

I'd like to know the Precompile & compiler options for accepting single quotes in COBOL DB2 program. While moving value to variable, single quotes are not taking. And same way in DB2 insert query also single quotes are not taking. I used APOST in precompilation and compilation, then only for DB2 insert query quotes are accepted, but not to cobol move variables.

After APOST ( APOSTSQL also) in precompile & compile
1. - INSERT INTO TAB1 VALUES ( 123, 'ABC') is working
2. MOVE 'ABC' TO VAR1 is not working.

Can some one tell me apart from compile options, where else I should change the settings?

Thanks in advance..
SMRAO123
 
Posts: 12
Joined: Thu Oct 28, 2010 12:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL DB2 Compiler options

Postby BillyBoyo » Wed Apr 16, 2014 6:01 pm

You need to post any actual messages and details for "not working".
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: COBOL DB2 Compiler options

Postby SMRAO123 » Thu Apr 24, 2014 6:37 pm

Not working means - values in host variables are converting to junk values

This is the code and results:

EXEC SQL
SELECT IBMREQD INTO :WS-NAME FROM SYSIBM.SYSDUMMY1
END-EXEC.
MOVE SQLCODE TO WS-SQLCODE.
DISPLAY 'SQLCODE=' WS-SQLCODE, ' WS-NAME=' WS-NAME

OUTPUT: SQLCODE= 0 WS-NAME=
WS-NAME value Y has been converted and this is actual value - SQLCODE= 0 WS-NAME=ß

Similar way while inserting data into table also the value moved to host variable is converting and some junk value is going to table.

I'd like to know is it bcoz of compiler options? if so what are the compile options need to be used..

Thanks
SMRAO123
 
Posts: 12
Joined: Thu Oct 28, 2010 12:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL DB2 Compiler options

Postby dick scherrer » Thu Apr 24, 2014 6:53 pm

Hello and welcome to the forum,

I'd like to know is it bcoz of compiler options?
Probably not, depending on what you mean by "junk".

You need to post the contents of a problem row (in hex) and post the values that were supposed to be inserted (in hex also).

How is var1 defined?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: COBOL DB2 Compiler options

Postby SMRAO123 » Thu Apr 24, 2014 7:03 pm

Lets consider the select statement I mentioned. As per the select statement the output should be Y, but the value displayed is some junk (ß) like this -
SQLCODE= 0WS-NAME=ß

( below are the hex values ).
4EDDCDCC74444FEE6DCDC752
02833645E000006205145E90
SMRAO123
 
Posts: 12
Joined: Thu Oct 28, 2010 12:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL DB2 Compiler options

Postby NicC » Thu Apr 24, 2014 7:40 pm

As SQLCODE is 0 I would expect to see it as

and I do not see that anywhere in what you posted.

What is the PIC definition of WS-NAME?
What is its value in hex? (I expect to see something like this:
WS-NAME >ABC<
EE6DCDC46CCC444
62051450E123C00

What is the PIC definition of IBMREQD and what is its expected value?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: COBOL DB2 Compiler options

Postby dick scherrer » Thu Apr 24, 2014 9:59 pm

Hello,

You do realize that the "junk" values you posted are the hex from the DISPLAY . . . ?

The info given does not provide enough for us(me) to work with.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: COBOL DB2 Compiler options

Postby SMRAO123 » Thu Apr 24, 2014 10:49 pm

Sorry for the confusion.

WS-NAME is declared as WS-NAME PIC X(2)

After SELECT statement, nothing is displayed in the SYSOUT for WS-NAME, after opening in edit mode (SE), value is displayed as ß
SMRAO123
 
Posts: 12
Joined: Thu Oct 28, 2010 12:00 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL DB2 Compiler options

Postby Terry Heinze » Thu Apr 24, 2014 11:01 pm

ß is X'E1' or decimal 225. I don't see a hex E1 in your posts.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: COBOL DB2 Compiler options

Postby SMRAO123 » Thu Apr 24, 2014 11:32 pm

ß is x'59'
SMRAO123
 
Posts: 12
Joined: Thu Oct 28, 2010 12:00 pm
Has thanked: 0 time
Been thanked: 0 time

Next

Return to DB2

 


  • Related topics
    Replies
    Views
    Last post