View previous topic :: View next topic
|
Author |
Message |
umeshkmrsh
New User
Joined: 21 Sep 2005 Posts: 79 Location: India
|
|
|
|
How do we use alternate index to browse a KSDS file in COBOL program? Please provide me with the code if any one know how to.
Regards,
Umesh |
|
Back to top |
|
|
gskulkarni
New User
Joined: 01 Mar 2006 Posts: 70
|
|
|
|
Code: |
//MASTERA DD DSNAME=CLUSTERNAME,DISP=OLD
//MASTERA1 DD DSNAME=PATH1,DISP=OLD
//MASTERA2 DD DSNAME=PATH2,DISP=OLD
FILE-CONTROL.
SELECT MASTER3FILE ASSIGN TO MASTERA
RECORD KEY IS EM3NAME
ALTERNATE RECORD KEY IS EM3PHONE
ALTERNATE RECORD KEY IS EM3CITY |
.1/ The base cluster name is CLUSTERNAME.
.2/ The name of the first alternate index path is PATH1.
.3/ The name of the second alternate index path is PATH2.
.4/ The ddname for the base cluster is specified with the ASSIGN clause.
.5/ The key, EM-PHONE, relates to the first alternate index.
.6/ The key, EM-CITY, relates to the second alternate index. |
|
Back to top |
|
|
umeshkmrsh
New User
Joined: 21 Sep 2005 Posts: 79 Location: India
|
|
|
|
Thanks...
Now what is the syntax/methos to use these alternate indexes while READ statement.
For Example:
(1) If we do
MOVE "ENAME" TO EM3NAME
READ MASTER3FILE
we will use EMPNAME key field.
(2) If we do
MOVE "DELHI" TO EM3CITY
READ MASTER3FILE
we will use CITY alternate index
(3) What if we do ???
MOVE "ENAME" TO EM3NAME
MOVE "DELHI" TO EM3CITY
READ MASTER3FILE
Which index will be used?
Please clarify... |
|
Back to top |
|
|
|