IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to use Alternate Index in Cobol program?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Fri May 26, 2006 11:32 am
Reply with quote

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
View user's profile Send private message
gskulkarni

New User


Joined: 01 Mar 2006
Posts: 70

PostPosted: Fri May 26, 2006 2:59 pm
Reply with quote

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
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Fri May 26, 2006 3:58 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top