Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Former Member Absent Member.
Absent Member.
381 views

[archive] SQL Varchar

[Migrated content. Thread originally posted on 19 September 2005]

Hello,
Is anyone having trouble passing SQL Server Varchar fields into working-storage in Acucobol 6.2?
My WS area is set up as follows:

01 A-Test-Data.
05 A-Field1.
06 A-Field1-Length PIC s9(4) comp-5.
06 A-Field1-Name PIC X(50).
05 A-Field2.
06 A-Field2-Length PIC s9(4) comp-5.
06 A-Field2-Name PIC X(50).

My SQL Code looks like this:

EXEC SQL
DECLARE COBCUR1 CURSOR FOR
SELECT Field1
, Field2
FROM TBL_Test WITH (NOLOCK)
FOR READ ONLY
END-EXEC
EXEC SQL
OPEN COBCUR1
END-EXEC
EXEC SQL
FETCH COBCUR1 INTO :A-Test-Data
END-EXEC

where Field1 and Field2 are varchar(50) fields in tbl_Test.

When I execute this code, the data from Field1 is lost and the data from Field2 is put into A-Field1-Name.
If anyone has had similar trouble, please let me know how you solved the problem. The same code worked fine on version 6.0.
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.