I wanted to ask everyone a question for a relative newbie. most of the
cobol I've done has had some form of SQL, depending on the version of the
DBMS, embedded in the COBOL itself. This is how I thought it had to be
done. This applies to both SQL code for RDBMS and file reads for VSAM-type
files.
My question is, are there versions of COBOL out there that allow SQL to be
called outside a program, or by language design, must the SQL be embedded in
the COBOL programm and cannot be handled externally. Thank you very much in
advance for your help!
|
|
0
|
|
|
|
Reply
|
arenaTR (70)
|
12/16/2003 5:29:18 PM |
|
Using ODBC or JDBC can isolate SQL/database from program for better
maintenance.
But ODBC is designed for C/C++ and JDBC is for Java. Both of them are TCP/IP
based. If your compiler didn't do it, you can do it yourself as follows:
IF your COBOL can call C/C++, you can use ODBC from C/C++,
or use JDBC through JNI,C/C++., provided you can got an ODBC/JDBC driver for
your platform.
"arenaTR" <arenaTR@comcast.net> wrote in message
news:qvWdnUof0dpv3UKi4p2dnA@comcast.com...
> I wanted to ask everyone a question for a relative newbie. most of the
> cobol I've done has had some form of SQL, depending on the version of the
> DBMS, embedded in the COBOL itself. This is how I thought it had to be
> done. This applies to both SQL code for RDBMS and file reads for
VSAM-type
> files.
>
> My question is, are there versions of COBOL out there that allow SQL to be
> called outside a program, or by language design, must the SQL be embedded
in
> the COBOL programm and cannot be handled externally. Thank you very much
in
> advance for your help!
>
>
|
|
0
|
|
|
|
Reply
|
tli (68)
|
12/16/2003 9:28:54 PM
|
|
"arenaTR" <arenaTR@comcast.net> wrote
> I wanted to ask everyone a question for a relative newbie. most of the
> cobol I've done has had some form of SQL, depending on the version of the
> DBMS, embedded in the COBOL itself. This is how I thought it had to be
> done. This applies to both SQL code for RDBMS and file reads for VSAM-type
> files.
>
> My question is, are there versions of COBOL out there that allow SQL to be
> called outside a program,
What do you mean by 'outside'. Of course you can run a database
client program where you can just type in some SQL and have it run,
but they are not 'COBOL'.
> or by language design, must the SQL be embedded in
> the COBOL programm and cannot be handled externally.
SQL is a searate language and can be executed directly using a SQL
client or embedded in many other languages. For example when I want
to manipulate the database, such as create new table I use a shell
script (Linux):
file newtables.sh:
-----------------------------------------------
psql -U postuser accounts <<****
CREATE TABLE debtor
( ..... );
INSERT INTO debtor VALUES (...);
....
****
------------------------------------------------
This runs program psql which is a database client (not in COBOL) and
the << indicates to pass input from the script as if it were from a
keyboard untill a line starting ****.
|
|
0
|
|
|
|
Reply
|
riplin (4126)
|
12/16/2003 11:04:39 PM
|
|
"arenaTR" <arenaTR@comcast.net> wrote in message
news:qvWdnUof0dpv3UKi4p2dnA@comcast.com...
> I wanted to ask everyone a question for a relative newbie. most of the
> cobol I've done has had some form of SQL, depending on the version of the
> DBMS, embedded in the COBOL itself. This is how I thought it had to be
> done. This applies to both SQL code for RDBMS and file reads for
VSAM-type
> files.
>
> My question is, are there versions of COBOL out there that allow SQL to be
> called outside a program, or by language design, must the SQL be embedded
in
> the COBOL programm and cannot be handled externally. Thank you very much
in
> advance for your help!
If using Oracle you should be able to call a stored procedure. I believe DB2
provides something similar.
|
|
0
|
|
|
|
Reply
|
Dan
|
12/17/2003 12:31:19 AM
|
|
arenaTR wrote:
> I wanted to ask everyone a question for a relative newbie. most of the
> cobol I've done has had some form of SQL, depending on the version of the
> DBMS, embedded in the COBOL itself. This is how I thought it had to be
> done. This applies to both SQL code for RDBMS and file reads for VSAM-type
> files.
>
> My question is, are there versions of COBOL out there that allow SQL to be
> called outside a program, or by language design, must the SQL be embedded in
> the COBOL programm and cannot be handled externally. Thank you very much in
> advance for your help!
Well, I'm not quite sure I understand... You either put your SQL
statements in an "Exec SQL ... End-Exec" block, or straight into the
code (depending on how your compiler / pre-processor work) if you want
it to be part of the COBOL program. Now, if you have another component
(written, say, in C++) and you called it from your COBOL program, it
could do SQL and return the data back to COBOL. Is that what you're asking?
Of course, mileage varies greatly depending on your operating
environment and target database...
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ / \ / ~ Live from Montgomery, AL! ~
~ / \/ o ~ ~
~ / /\ - | ~ LXi0007@Netscape.net ~
~ _____ / \ | ~ http://www.knology.net/~mopsmom/daniel ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ I do not read e-mail at the above address ~
~ Please see website if you wish to contact me privately ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
0
|
|
|
|
Reply
|
lxi0007 (1830)
|
12/17/2003 1:01:22 AM
|
|
|
4 Replies
33 Views
(page loaded in 0.103 seconds)
|