> 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.
>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
________________________________________
ACCESS MODE IS DYNAMIC will work too.