Highlighted
Absent Member.
Absent Member.
501 views

[archive] ACUSQLdata type issue

[Migrated content. Thread originally posted on 28 June 2010]

I am attempting to insert an HTML document into a MSSQL Server 2005 "text" data type field but I am getting the error message:

SQLCODE: 000000001 SQLSTATE: 00206
Operand type clash: image is incompatible with text

This is working Storage:
(ws-web-E-STATEMENT-DETAIL-LINES is the HTML doc)

01 ws-web-E-STATEMENT-ARC-REC.
02 ws-web-E-STATMENT-KEY.
03 ws-web-E-STATMENT-COMPANY PIC XX JUSTIFIED RIGHT.
03 ws-web-E-STATMENT-ACCOUNT-NUMBER
PIC X(6) JUSTIFIED RIGHT.
03 ws-web-E-STATEMENT-DATE-KEY.
05 ws-web-E-STATEMENT-YEAR PIC 99.
05 ws-web-E-STATEMENT-MONTH PIC 99.
05 ws-web-E-STATEMENT-DAY PIC 99.
02 ws-web-E-STATEMENT-DETAIL-LINES PIC X(31986).

Here is the ACUSQL insert:

EXEC SQL INSERT INTO bsmgr_new.dbo.estatarc_1
(E_STATMENT_COMPANY, E_STATMENT_ACCOUNT_NUMBER,
E_STATEMENT_YEAR, E_STATEMENT_MONTH,
E_STATEMENT_DAY, E_STATEMENT_DETAIL_LINES)
VALUES (:ws-web-E-STATMENT-COMPANY,
:ws-web-E-STATMENT-ACCOUNT-NUMBER,
:ws-web-E-STATEMENT-YEAR,
:ws-web-E-STATEMENT-MONTH,
:ws-web-E-STATEMENT-DAY,
:ws-web-E-STATEMENT-DETAIL-LINES)
END-EXEC.

Any help would be much appreciated.
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] ACUSQLdata type issue

I discovered that getting rid of the trailing nulls takes care of the problem.

inspect ws-web-E-STATEMENT-DETAIL-LINES replacing trailing
null by space.

However the insert puts a large amount of white space in the field following the HTML.
I need to be able to make ws-web-E-STATEMENT-DETAIL-LINES variable length but I don't think there is any way to do it, is there?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ACUSQLdata type issue

You could find the last character in the html, and then change your code to:

VALUES (:ws-web-E-STATMENT-COMPANY,
:ws-web-E-STATMENT-ACCOUNT-NUMBER,
:ws-web-E-STATEMENT-YEAR,
:ws-web-E-STATEMENT-MONTH,
:ws-web-E-STATEMENT-DAY,
:ws-web-E-STATEMENT-DETAIL-LINES(1:LAST-CHAR-POSITION))
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.