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
 

 

AIX VSAM KEY POSITION IN COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: AIX VSAM KEY POSITION IN COBOL
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

Site Director


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

PostPosted: Mon Jun 06, 2011 3:31 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Mon Jun 06, 2011 3:32 pm    Post subject: Reply to: AIX VSAM KEY POSITION IN COBOL
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: 7931
Location: Bellevue, IA

PostPosted: Mon Jun 06, 2011 4:45 pm    Post subject:
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    Post subject: Reply to: AIX VSAM KEY POSITION IN COBOL
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    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
No new posts how to recover an uncataloged VSAM da... archanamuthukrishnan All Other Mainframe Topics 3 Wed Jan 11, 2017 6:18 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts Underlying DB2 VSAM LDS - SMF recording vasanthz All Other Mainframe Topics 6 Thu Jan 05, 2017 4:20 am


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