Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cobol/400 question

345 views
Skip to first unread message

Nisimkain

unread,
Aug 11, 1996, 3:00:00 AM8/11/96
to

How do you perform the RPG "CHAIN" operation in COBOL/400? TIA, Carl
Sherwin.

Big E

unread,
Aug 11, 1996, 3:00:00 AM8/11/96
to

In article <4ukltk$b...@newsbf02.news.aol.com>, nisi...@aol.com
(Nisimkain) wrote:

> How do you perform the RPG "CHAIN" operation in COBOL/400? TIA, Carl
> Sherwin.

With the READ statement. First, you have to define your database file as
follows:

ENVIRONMENT DIVISION.
.
.
.
SELECT customer-master ASSIGN TO DATABASE-custmast
ORGANIZATION IS INDEXED
ACCESS MODE IS RANDOM
RECORD KEY IS EXTERNALLY-DESCRIBED-KEY.

With EXTERNALLY-DESCRIBED-KEY, the COBOL compiler brings into the program
the definition of the key structure. Let's suppose the fields that make
up the record key are company-id and customer-id. Then, to "CHAIN" to a
particular record, do:

MOVE "01" TO company-id.
MOVE "12345678" TO customer-id.

READ customer-master
INVALID KEY
PERFORM customer-not-found
NOT INVALID KEY
PERFORM process-customer-record
END-READ.

Notice the PERFORMs in the READ statement. If the key is not found, it
executes paragraph customer-not-found, which could be designed to display
an error message at the screen, or do whatever else is necessary. If the
record is found, it executes paragraph process-customer-record, which does
what its name implies.

Dan Riehl

unread,
Aug 12, 1996, 3:00:00 AM8/12/96
to

On 11 Aug 1996 09:07:00 -0400, nisi...@aol.com (Nisimkain) wrote:

>How do you perform the RPG "CHAIN" operation in COBOL/400? TIA, Carl
>Sherwin.

It looks like Big E answered your question, Now for the tough one.....

How do you do READE and READPE in COBOL??????????????????????


UH????????


dan
__________________________________________
Dan Riehl
Seattle, Wa
dri...@toolnet.com
http://www.toolnet.com
________________________________________

David R. Caldwell

unread,
Aug 12, 1996, 3:00:00 AM8/12/96
to

One addition to Big E's reply.

ACCESS MODE IS DYNAMIC will work too.

0 new messages