TSTEVENS123
Programmer
I am new at using the InstantSQL for RMCOBOL. I have rmcobol installed on a 64-bit Unix machine. I have setup an ODBC connection to a DB2 v12 mainframe database. When my program does the SQL BIND Command any field that is CHAR is spaces when I display my working storage field. I also have 2 decimal columns that I pull from the table and they display fine. If I get a good sql-ok after the fetch then I display my working storage fields. The decimals show the values but the cus-id is always spaces. I tried pulling other char columns from the table in the select statement and they are all spaces. I also turned on unixODBC trace and every sql command gets good return codes. Any help would be appreciated.
Working Storage section....
01 DM-RATE-TABLE.
02 CUS-ID PIC X(9).
02 DAILY-INT-AM-PER-HUN PIC 9.9(9).
02 INT-AM-PER-HUN PIC 9.9(9).
Procedure section....
050-ISQL-CONNECT-DATASOURCE.
SQL CONNECT DATASOURCE
sql-ConnectionHandle,
sql-DataSourceName,
sql-UserName,
sql-UserPassword.
IF NOT sql-OK
DISPLAY "<Error connecting to SD0T data source.>"
PERFORM 1000-SQL-ERROR thru 1000-exit
STOP RUN.
060-DISCONNECT-SQLSERVER.
MOVE SQLServer-ConnectionHandle TO sql-ConnectionHandle.
PERFORM 070-ISQL-DISCONNECT-DATASOURCE.
MOVE ZERO TO SQLServer-ConnectionHandle.
070-ISQL-DISCONNECT-DATASOURCE.
SQL DISCONNECT DATASOURCE
sql-ConnectionHandle.
MOVE ZERO TO sql-ConnectionHandle.
080-SQL-SHUTDOWN.
SQL SHUTDOWN.
100-CONSTRUCT-QUERY.
SQL CONSTRUCT QUERY sql-QrySQL,
"SELECT CUS_ID, DAILY_INT_AM_PER_HUN, INT_AM_PER_HUN ",
"FROM CX.DAILY_RATE",
"WHERE PMT_DT = '2021-02-14'".
200-PREPARE-QUERY.
IF sql-ConnectionHandle = ZERO
PERFORM 050-ISQL-CONNECT-DATASOURCE.
SQL PREPARE QUERY
sql-QueryHandle,
sql-ConnectionHandle,
sql-QrySQL.
SQL BIND PARAMETER
sql-QueryHandle
1, sql-Char, OMITTED,
2, sql-Decimal, OMITTED,
3, sql-Decimal, OMITTED.
300-EXECUTE-QUERY.
SQL START QUERY
sql-QueryHandle.
400-BIND-DATA.
SQL BIND COLUMN sql-QueryHandle
1, CUS-ID, OMITTED,
2, DAILY-INT-AM-PER-HUN, OMITTED,
3, INT-AM-PER-HUN, OMITTED.
500-FETCH-ROW.
SQL FETCH ROW
sql-QueryHandle
If sql-OK
DISPLAY DM-RATE-TABLE LINE 19 POSITION 1
ACCEPT WSOK LINE 24 POSITION 1.
600-END-QUERY.
SQL END QUERY
sql-QueryHandle.
Working Storage section....
01 DM-RATE-TABLE.
02 CUS-ID PIC X(9).
02 DAILY-INT-AM-PER-HUN PIC 9.9(9).
02 INT-AM-PER-HUN PIC 9.9(9).
Procedure section....
050-ISQL-CONNECT-DATASOURCE.
SQL CONNECT DATASOURCE
sql-ConnectionHandle,
sql-DataSourceName,
sql-UserName,
sql-UserPassword.
IF NOT sql-OK
DISPLAY "<Error connecting to SD0T data source.>"
PERFORM 1000-SQL-ERROR thru 1000-exit
STOP RUN.
060-DISCONNECT-SQLSERVER.
MOVE SQLServer-ConnectionHandle TO sql-ConnectionHandle.
PERFORM 070-ISQL-DISCONNECT-DATASOURCE.
MOVE ZERO TO SQLServer-ConnectionHandle.
070-ISQL-DISCONNECT-DATASOURCE.
SQL DISCONNECT DATASOURCE
sql-ConnectionHandle.
MOVE ZERO TO sql-ConnectionHandle.
080-SQL-SHUTDOWN.
SQL SHUTDOWN.
100-CONSTRUCT-QUERY.
SQL CONSTRUCT QUERY sql-QrySQL,
"SELECT CUS_ID, DAILY_INT_AM_PER_HUN, INT_AM_PER_HUN ",
"FROM CX.DAILY_RATE",
"WHERE PMT_DT = '2021-02-14'".
200-PREPARE-QUERY.
IF sql-ConnectionHandle = ZERO
PERFORM 050-ISQL-CONNECT-DATASOURCE.
SQL PREPARE QUERY
sql-QueryHandle,
sql-ConnectionHandle,
sql-QrySQL.
SQL BIND PARAMETER
sql-QueryHandle
1, sql-Char, OMITTED,
2, sql-Decimal, OMITTED,
3, sql-Decimal, OMITTED.
300-EXECUTE-QUERY.
SQL START QUERY
sql-QueryHandle.
400-BIND-DATA.
SQL BIND COLUMN sql-QueryHandle
1, CUS-ID, OMITTED,
2, DAILY-INT-AM-PER-HUN, OMITTED,
3, INT-AM-PER-HUN, OMITTED.
500-FETCH-ROW.
SQL FETCH ROW
sql-QueryHandle
If sql-OK
DISPLAY DM-RATE-TABLE LINE 19 POSITION 1
ACCEPT WSOK LINE 24 POSITION 1.
600-END-QUERY.
SQL END QUERY
sql-QueryHandle.