×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Rmcobol InstantSQL

Rmcobol InstantSQL

Rmcobol InstantSQL

(OP)
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.

RE: Rmcobol InstantSQL

1. Have you confirmed that there is data in the CustID column in DB2?
2. Have you confirmed the size and data type of the CustID column in DB2? Is it Char or Varchar? Is it size 9? Are you getting truncation because the DB2 field is larger and there are, perhaps, leading spaces? Is ODBC acting weird because the field sizes are different or the field types are different?
3. Try defining CUST-ID as PIC 9(9) and see if ODBC will do an implicit conversion to numbers. (this is a workaround)

The fact that you can't get anything except SPACES for any CHAR/VARCHAR column is worth a support call.

RE: Rmcobol InstantSQL

(OP)
Yes the CUS_ID has data. When I do the same select statement in QMF for windows, I get 8 records back all 3 columns have data. The column is char and defined as 9 characters NOT NULL. I wondered if there was an environment variable setting or something that we might have set wrong.

RE: Rmcobol InstantSQL

yeah, maybe. I am not a RM Cobol person. I'm mostly Microfocus, and various proprietary flavors like IBM mainframe, Unisys, etc. And we used Oracle Pro*COBOL for our SQL calls from Microfocus. In Oracle, the process is called "Binding", which may or may not be the IBM or RM terminology.

RE: Rmcobol InstantSQL

(OP)
We finally found the issue. My Linux admin had to change the /etc/odbcint.ini file to a different DB2 driver. Reading some IBM pages, they suggest using libdb2o.so instead of libdb2.so.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close