Page 1 of 2

COBOL DB2 Compiler options

PostPosted: Wed Apr 16, 2014 5:03 pm
by SMRAO123
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..

Re: COBOL DB2 Compiler options

PostPosted: Wed Apr 16, 2014 6:01 pm
by BillyBoyo
You need to post any actual messages and details for "not working".

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 6:37 pm
by SMRAO123
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

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 6:53 pm
by dick scherrer
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?

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 7:03 pm
by SMRAO123
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

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 7:40 pm
by NicC
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?

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 9:59 pm
by dick scherrer
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.

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 10:49 pm
by SMRAO123
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 ß

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 11:01 pm
by Terry Heinze
ß is X'E1' or decimal 225. I don't see a hex E1 in your posts.

Re: COBOL DB2 Compiler options

PostPosted: Thu Apr 24, 2014 11:32 pm
by SMRAO123
ß is x'59'