Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to use Alternate Index in Cobol program?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to use Alternate Index in Cobol program?
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us