Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

InstantSQL C.R.U.D. Example Request 1

Status
Not open for further replies.

SiouxCityElvis

Programmer
Jun 6, 2003
228
0
0
US
Hello,

Anyone have good C.R.U.D.(Create,Read,Update,Delete) examples using InstantSQL. I'm brand new to using this, so I need to do some simple COBOL code accessing SQL Databases.
I'm Running RMCOBOL-85 on Linux. Just downloaded the InstantSQL Jumpstart Kit. Copied file into my /usr/rmcobol/ directory. Uncompressed/Extracted lisql23_linux.tar.gz file. Results look like:

[root@Vallon rmcobol]# tar -xzvf lisql23_linux.tar.gz
LISQLALL.CPY
LISQLDCL.CPY
LISQLDCN.CPY
LISQLDEF.CPY
LISQLDER.CPY
LISQLDPM.CPY
LISQLDQY.CPY
LISQLRPL.CPY
LISQLXCL.CPY
LISQLXCN.CPY
README.TXT
libisql.so
[root@Vallon rmcobol]#

Thanks.
-David
 
AmarilloElvis said:
How do I pinpoint the problem using RMCOBOL-85 in this type of situation?
Compile the program with a listing (the -l option) and view the listing with an editor. The line number will be the leftmost item on the listing line. InstantSQL makes luxurious use of REPLACE, so the source program is expanded quite a bit by the action of REPLACE and, of course, the extensive COPY files.

Tom Morrison
 
the -| is a dash-pipe??? or dash-ell?

I've tried both and I'm lost...

This is what happens when I use dash pipe...

Code:
[root@Vallon rmcobol]# ccomp SQLEXAMPLE.CBL -|
> 
> crun SQLEXAMPLE.COB
RM/COBOL Compiler - Version 8.00.00 for Large File Linux (Intel).
RM/COBOL Development System issued to HERRING NATIONAL BANK.
Configured for one user.
Copyright (c) 1985-2003 by Liant Software Corp.  All rights reserved.
Registration number: 8L-1000-08092-0001

RM/COBOL Runtime - Version 8.01.00 for Large File Linux (Intel).
RM/COBOL Runtime System issued to HERRING NATIONAL BANK.
Configured for 20 users.
Copyright (c) 1985-2003 by Liant Software Corp.  All rights reserved.
Registration Number: 8L-1000-08093-0020

COBOL procedure error 225 (RM/COBOL object header not valid).  Error loading
main program /usr/rmcobol/SQLEXAMPLE.COB.
COBOL procedure error 204 (program not found).  Error starting application
SQLEXAMPLE.COB.
Write error for file "(system output file)".

 
Also,

I can not for the life of me find an example for INSERT statements(adding records) to an SQL database.

I'm wondering if any of this can actually be accomplished. It's out there, but I haven't found an example that actually works.

Pure ignorance on my part and I can't find answers. Pressure mounting.

PLEASE HELP!!!!
-David
 
It is the L option.

It appears that your ccomp shell script (which is not part of the RM/COBOL release product) may not be getting the L option from the ccomp command line arguments to the rmcobol command line contained within the script.

Tom Morrison
 
I can not for the life of me find an example for INSERT statements(adding records) to an SQL database.
You may start looking at the actual documentation for MyODBC here. INSERT is a standard SQL statement.
Pressure mounting.
A tough time to be learning SQL, I think.[hairpull]

Tom Morrison
 
Yes, I created the ccomp for rmcobol command. It is an Alias.

I'll try it using the rmcobol command instead with the -l option. Is there a specific file that the listing appears in? Here's what I did from compile through run...

Code:
[root@Vallon rmcobol]# rmcobol SQLEXAMPLE.CBL -l
RM/COBOL Compiler - Version 8.00.00 for Large File Linux (Intel).
RM/COBOL Development System issued to HERRING NATIONAL BANK.
Configured for one user.
Copyright (c) 1985-2003 by Liant Software Corp.  All rights reserved.
Configured options:  -L
Registration number: 8L-1000-08092-0001


Total generated object size:       9106 (X"00002392") bytes

Errors: 0, Warnings: 0, Lines: 1152 for program SQLEXAMPLE.
Compilation complete -- Programs: 1, Errors: 0, Warnings: 0.
 
[root@Vallon rmcobol]# runcobol SQLEXAMPLE.COB

RM/COBOL Runtime - Version 8.01.00 for Large File Linux (Intel).
RM/COBOL Runtime System issued to HERRING NATIONAL BANK.
Configured for 20 users.
Copyright (c) 1985-2003 by Liant Software Corp.  All rights reserved.
Registration Number: 8L-1000-08093-0020

COBOL procedure error 204 (program not found) at line 1130 in program
SQLEXAMPLE.COB (/usr/rmcobol/SQLEXAMPLE.COB) compiled 2004/09/08 11:34:00.
[root@Vallon rmcobol]#

I'm not sure where to look now that I've compiled using -l and ran the program.

Where do you mean for me to look when you said
"Compile the program with a listing (the -l option) and view the listing with an editor."

Our java programmer that set up the MySQLODBC is looking to see if there are any bugs there as well.

Where
Thanks
-David
 
Excuse me, I meant the java programmer is looking into the MyODBC he setup not MySQLODBC. Sorry.
 
Tom,

Yes, I understand the INSERT deal. I was making a mystery out of something that didn't need to be a mystery.

The EXSQRY01 sample from Liant is a good one. I will just substitute INSERT for UPDATE in the ws-update-sql variable.
Sorry about that.

Thanks.
-David
 
Is there a specific file that the listing appears in?
In this case, how about SQLEXAMPLE.LST, in the same directory as SQLEXAMPLE.CBL? (The L option (along with all its friends) are well described in the RM/COBOL User's Guide.)

Tom Morrison
 
Tom,

The java programmer verified that the MyODBC is working simply by using the "isql". We've looked at the tables through isql, queried, updated, etc and it seems to work fine.

I looked at my SQLEXAMPLE.LST file per your instructions and pinpointed the line the runtime gave for error 204.
Code:
1130    000005>0<002400       CALL "LISQL" GIVING sql-Return USING sql-ConnectDS         LISQLRPL^M
 1131          {0}                                  sql-ConnectionHandle^M
 1132                            "test"^M
 1133                            username^M
 1134                            password^M

1130 was the line it said had the 204 error.

It looks like it is CALL "LISQL" on that line which doesn't exist, but the LISQLRPL(on the same line - 1130) does.

I looked at the .tar file I extracted and all my lisql files that I extracted into my /usr/rmcobol directory and there is no
LISQL program!
The files I have in that directory are:

lisql23_linux.tar.gz
lisqldcl.cpy
lisqldef.cpy
lisqldpm.cpy
lisqlrpl.cpy
lisqlxcn.cpy
lisqlall.cpy
lisqldcn.cpy
lisqlder.cpy
lisqldqy.cpy
lisqlxcl.cpy

and

LISQLALL.CPY
LISQLDCL.CPY
LISQLDCN.CPY
LISQLDEF.CPY
LISQLDER.CPY
LISQLDPM.CPY
LISQLDQY.CPY
LISQLRPL.CPY
LISQLXCL.CPY
LISQLXCN.CPY

I kind of think we're getting close but I don't know what I don't gather much understanding out of line 1130 above. I still don't know the solution here.
Any ideas?

Thanks.
-David
 
If I'm not wrong your problem is that you are not passing the .so library on the command line.

You need to do one of the following

1- Issue the runcobol command referencing the isql library on the command line.

runcobol mypgm -l libisql.so

2- Put the .so file on the default rmcobol shared library
rmcobolso

Look at apendix D of your users manual.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
You will need to supply the libisql library on the runcobol command (using runcobol's L option) (yes, it is the L option - but this time on the runcobol command). LISQL is an entry point in that library. (The file you should be finding is libislq.so).

Tom Morrison
 
I hate trouble shooting Network admin related issues :(

Latest and greatest is that I'm not getting the old problem after installing iodbc and running prgname -l=libisql.so

but I'm getting the connection error from the DISPLAY stmt in my code.

-David
 
Tom, or anyone who has had the challenge of setting up MyODBC on Linux...

The README.TXT

Says

"The iODBC driver manager uses several environment variables to track ODBC data sources. The OpenLink installation procedure installs a file (named openlink.sh in the test installation) that sets the appropriate environment variables. These environment variables must be set before executing a runcobol command containing InstantSQL; placing these settings in the runcobolrc resource file will not have the desired effect."

Where do we get this openlink.sh script?

We went to the site and it doesn't point us to openlink.sh

Thanks.
-David
 
Note that it says, “The OpenLink installation procedure installs a file (named openlink.sh in the test installation)” (emphasis added). It is installed when you install iODBC.

The point is that, having installed iODBC and MyODBC, you still have to configure the odbc.ini file so that iODBC knows about the database (their terminology is DSN which means Data Source Name).

BTW my guess is that you can find everything you need for iODBC on no need to go to openlinksw.com anymore. Things change in the Open Source community. Coping with the change is one of the costs of "free software".


Tom Morrison
 
Also, there is a Tek-Tips forum for MySQL/MyODBC questions: thread436-689938

Be sure you mention that it is MyODBC on Linux.

Tom Morrison
 
Earlier I promised some templates.
It seems to me that others, specifically Tom Morrison, has the technical know-how you actually need.
I assume that it is enough, I will not distract you with design issues (thus dropping my promise).
Note: If you are interested in design issues then drop me a mail:
ahlers<underscore>wim<at-sign>hotmail<period>com.


Regards, Wim Ahlers.
 
Everyone(Especially Tom - the man of great COBOL wizardry),

We have resolved the connection issues and now I'm ready to start using InstantSQL queries, update, and delete functions.

Connection was made to our test data source.
The only challenge now is that if I want to run my InstantSQL, I am needing to put all the extracted instantsql files in the current directory I'm running my COBOL program from.

That probably has something to do with RUNPATH, but we're happy at this point. Our network admin will need to look into that issue.

Thanks for all the help.
-David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top