× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Kiran,

Perhaps we aren't understanding your question. As Robert replied, you can
simply "Change your COBOL program type to SQLCBLLE" and it would compile.
I would definitely try that first. Trying this will tell you if you've
got the SQL-enabled compilers.

However if you don't have the SQL DevKit (Structured Query Language
Development Kit), you will need to convert it to "native database access"
instead of SQL. To do that efficiently would require more details for the
file "DB FILE"--i.e., what is the actual file name, is there a key field
which can be used to access the data, what are the names of "FIELD 1" and
"FIELD 2"?

The basic would be to add:

A SELECT statement in the ENVIRONMENT DIVISION under the INPUT-OUTPUT
SECTION and the FILE CONTROL paragraph.
An FD entry for the file in the DATA DIVISION under the FILE SECTION.
And in the PROCEDURE DIVISION:
an OPEN statement for the file,
possibly a START statement,
a READ statement,
a PERFORM statement or two.

e.g.:

Environment Division.
Input-output section.
file control.
select Db-file assign DBFILENAME
organization sequential
access sequential.

Data Division.
File section.
fd Db-file.
01 Db-record.
copy dd-all-formats of DBFILENAME.

Working-storage section.
01 Ws-count pic s999 packed-decimal.
01 Ws-var1 pic xxx.
01 Ws-var2 pic xxxx.

01 Control-flags.
05 EOF-flag pic 9.
88 Not-eof value 0.
88 Eof value 1.

Procedure Division.
Paragraph-name.
open input Db-file

set Not-eof to true
perform
until Eof
read Db-file
at end
set Eof to true
not at end
set Not-eof to true
end-read
if Not-eof
and Dbfield1 = Ws-var1
and Dbfield2 = Ws-var2
add 1 to Ws-count
end-if
end-perform

goback
.

If you've got some useful key fields, a START would be helpful. Then you
would specify ORGANIZATION INDEXED instead of ORGANIZATION SEQUENTIAL and
add RECORD KEY EXTERNALLY-DESCRIBED-KEY after ACCESS SEQUENTIAL.

Michael Quigley
Computer Services
The Way International
www.TheWay.org

cobol400-l-bounces@xxxxxxxxxxxx wrote on 06/22/2008 01:00:05 PM:

----- Message from "kiran eepi" <kiran.eepi@xxxxxxxxx> on Sun, 22
Jun 2008 15:17:01 +0530 -----

To:

cobol400-l@xxxxxxxxxxxx

Subject:

[COBOL400-L] cobol/400

Hi,
I just given below coding is in SQL and i need to change this coding
into
cobol/400,
Can anyone post what's the solution?

EXEC SQL
SELECT COUNT(*) INTO : WS-COUNT FROM DB FILE
WHERE
FIELD 1 = : WS-VAR 1
AND FIELD 2 = : WS-VAR 2
END-EXEC

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.