Joined: 02 Dec 2002 Posts: 618 Topics: 172 Location: Stockholm, Sweden
Posted: Tue May 07, 2024 1:23 am Post subject: COBOL and SQL IS BINARY DB2 column
We have a DB2 table defined with a column defined as Binary (yes, completely new for me as well).
When the copybook is generated the resulting DB2 definition is
Code:
,DL1_SEGMENT BINARY(16)
NOT NULL)
and its equivalent COBOL definition is
Code:
05 DL1-SEGMENT SQL TYPE IS BINARY(16).
My questions.
- has anyone had any experience of such a DB2 column
- can you, COBOL-wise, simply move a character group field to this COBOL
DL1-SEGMENT field and then do an SQL INSERT?
- might it be better to define the column as a BLOB?
Why is it being defined as BINARY you might ask?
Because, in reality, the example above might consist of 3 DL1-SEGMENT
fields, one packed, one character and another packed (using 16 bytes in total).
One of the problems I ran into was when trying to create test data for the column. No matter which variations I tried, the INSERT failed (both using DBEAVER and SPUFI in TSO).
There's lots of examples of how you can SELECT binary data from a table, but I haven't found one where they illustrate an INSERT of a row into a table where one column was binary.
We're trying to replace an Oracle database and there, the equivalent Oracle column is defined as raw/binary (what I was told).
We're then going to run a program that can mask sensitive data, but supposedly, this program can't handle low-values (as in an amount field containing '00000C'x - and yes, I'm aware that that logically contains low-values so what would the difference be if the column is defined as SQL BINARY or a VARCHAR field. Next question) _________________ Michael
Note the use of the x before the actual string. This way, I've defined the column as containing a packed value of 1 as well as 10 spaces. _________________ Michael
Joined: 26 Nov 2002 Posts: 12367 Topics: 75 Location: San Jose
Posted: Wed May 08, 2024 3:08 pm Post subject:
misi01,
If the db2 column is defined as BInary, and if you are loading a packed decimal number, do you get right values if there is a comparison or arithmetic operation on column ?
You are better off defining it as character _________________ Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum