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

AIX VSAM KEY POSITION IN COBOL


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

New User


Joined: 01 Jun 2011
Posts: 7
Location: INDIA

PostPosted: Mon Jun 06, 2011 3:23 pm
Reply with quote

Hi,

I have defined a VSAM with Key length 48 from position 0. And defined an AIX key with length 36 from position 0 again.

COBOL compiler throws an error during compiling

"ALTERNATE RECORD KEY" had the same leftmost character position as that of the "RECORD KEY" for this file. The "ALTERNATE RECORD KEY" was discarded.

How can I overcome this error?

I had two alternative options that I can do to overcome this -

1. Define a dummy field in 1st byte and include that as a part of primary key only.

2. Ignore the usage of AIX and go a head with normal VSAM options.

I need to know which one would be the best.? I have more than 3000 duplicates occuring for AIXs. AIX is non-uinque key.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 3:31 pm
Reply with quote

Hello,

It sounds like a different design may be in order. . .

If the main key is 48 bytes, why might the first 36 also need to be unique? Why is there a key for the first 36?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Jun 06, 2011 3:32 pm
Reply with quote

how much of the 36 char aix key will you have?

What are the file attributes which constitute a duplicate aix,
how many dups are there within a prim-key ?

why not prefill the prim-key with what ever you have,
do a start,
and then read. first read next will be an aix hit.

unless there is some overwhelming reason,
i would drop the aix and use the prim.

normally, an aix is based on other fields and not a partial of the primary,
especially starting from the high order.

and no, it would not be a good idea to add a dummy char to the primkey.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Jun 06, 2011 3:32 pm
Reply with quote

Quote:
2. Ignore the usage of AIX and go a head with normal VSAM options.


You have no need of an AIX (in Cobol) if it is just a beggining portion of the actual key. You can do what you want with START and READ NEXT, normal VSAM as you put it.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jun 06, 2011 4:45 pm
Reply with quote

From the COBOL Language Reference manual (link at the top of the page), section 4.2.10 on the ALTERNATE RECORD KEY clause:
Quote:
The leftmost character position of data-name-3 must not be the same as the leftmost character position of the prime RECORD KEY or of any other ALTERNATE RECORD KEY.
So to answer your question, you cannot overcome this error. You must either use the primary key to do generic reads, or you must rethink your entire approach so as not to attempt to use the alternate index you want to -- either by changing your program logic, or by adding data to the record so you can place the alternate index somewhere else in the record.
Back to top
View user's profile Send private message
Manicka Yazhini T

New User


Joined: 01 Jun 2011
Posts: 7
Location: INDIA

PostPosted: Mon Jun 06, 2011 4:50 pm
Reply with quote

Thanks All..!! I have to re-think on the approach.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
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 Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top