I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLThe error doesn't look like its coming from InstantSQL, but from your database software. It's possible that InstantSQL Construct Query did not construct the query string you expected, which might indicate a problem in InstantSQL or an error in your construct query request, that is, the values passed to construct query. You need to look at the constructed query string in the first parameter passed to SQL CONSTRUCT QUERY to see if it's the desired query. If so, then you need to determine why your database software can't prepare the given query.
I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLThe error doesn't look like its coming from InstantSQL, but from your database software. It's possible that InstantSQL Construct Query did not construct the query string you expected, which might indicate a problem in InstantSQL or an error in your construct query request, that is, the values passed to construct query. You need to look at the constructed query string in the first parameter passed to SQL CONSTRUCT QUERY to see if it's the desired query. If so, then you need to determine why your database software can't prepare the given query.
I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLI believe the problem is in the SQL CONSTRUCT QUERY. The source record has input but it is not built into the SQL field:


Everything thereafter is a result of calling the DB with a blank query string.
I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLYes, it looks like the sql-DirQtTrim didn't work. It will take me a while to set up a test environment to see why. However, I wouldn't think that's the correct directive to use in the construct query. Do you really want a quoted result, that is, an SQL literal? I would think the sql-DirTrim is the desired directive and that should work. If not, maybe you just need to use COBOL STRING statement to construct the query instead of SQL CONSTRUCT QUERY.
I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLYes, it looks like the sql-DirQtTrim didn't work. It will take me a while to set up a test environment to see why. However, I wouldn't think that's the correct directive to use in the construct query. Do you really want a quoted result, that is, an SQL literal? I would think the sql-DirTrim is the desired directive and that should work. If not, maybe you just need to use COBOL STRING statement to construct the query instead of SQL CONSTRUCT QUERY.
I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLThis is existing code that worked correctly under Windows 7, versions 10 and 12.13.
I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLI just tested SQL CONSTRUCT QUERY and it worked fine for me on Windows 10:
IDENTIFICATION DIVISION.
PROGRAM-ID. isql01.
DATE-COMPILED.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
COPY "lisqlall.cpy".
01 REST-OPERATOR PIC X(50).
01 SQL-REST-OPERATOR PIC X(50).
PROCEDURE DIVISION.
MAIN SECTION.
TEST-1.
DISPLAY "REST-OPERATOR = " SQL-REST-OPERATOR.
MOVE "LPRAED13" TO REST-OPERATOR.
DISPLAY "REST-OPERATOR = " REST-OPERATOR.
DISPLAY "SQL-REST-OPERATOR = " SQL-REST-OPERATOR.
SQL CONSTRUCT QUERY
SQL-REST-OPERATOR,
sql-DirQtTrim REST-OPERATOR.
DISPLAY "SQL-REST-OPERATOR = " SQL-REST-OPERATOR.
END PROGRAM isql01.
The above program produced the following output:
REST-OPERATOR =
REST-OPERATOR = LPRAED13
SQL-REST-OPERATOR =
SQL-REST-OPERATOR = 'LPRAED13'
COBOL STOP RUN at line 1126 in program ISQL01 (C:\\Liant\\test\\ISQL01.COB).
The construct query code space fills the target item and then inserts the appropriate strings from the supplied arguments. I note that your code doesn't check for errors; construct query does have some error paths. Since you're using CodeWatch, you can look at sql-return after the construct query to see if there was an error reported. Sql-return should be zero if there were no errors. On possible error is that SQL-REST-OPERATOR is too short for your latest REST-OPERATOR values. If I change my program to declare SQL-REST-OPERATOR as PIC X(5),
then I get the results you do (a blank SQL-REST-OPERATOR), but sql-return is 2125. (An SQL CONSTRUCT QUERY statement has resulted in an SQL statement text string longer than the COBOL data item supplied to receive the string.)
I'm trying to debug using v12.14. I've gotten everything to compile without errors; I can step through the code with Code Watch but when I get to my first IO call the actual SQL doesn't work:
,
,
,
,
,
,
, 
Any assistance would be greatly appreciated.
#InstantSQL#RMCOBOLI'll add the error logic and check the return.
Thanks.