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

Alternate Index Error !


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Wed Apr 21, 2010 11:35 am
Reply with quote

Hi,

I'm trying to access a VSAM file using an Alternate Key. I have created an alternate index for that VSAM. But while giving the alternate key and compiling, I'm getting the following error -

"ALTERNATE RECORD KEY" "AIR-TAXID" had the same leftmost character position as that of the "RECORD KEY" for this file"

Can anyone please help me with this.

Here is the file description -

SELECT AIRTAXID-MAST ASSIGN TO ADDRMSTR
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS AIR-KEY
ALTERNATE RECORD KEY IS
AIR-TAXID WITH DUPLICATES
FILE STATUS IS AIR-TAXID-STATUS.

Here's the Primary Key description -

01 AIR-TAXID-RECORD.
05 AIR-KEY.
10 AIR-KEY-COMPANY PIC X(004).
10 AIR-KEY-TAXID PIC 9(009).

Here's the alternate key -

01 AIR-TAXID PIC 9(009).

Am just using the second half of the Primary Key as the alternate key to fetch data.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Wed Apr 21, 2010 11:39 am
Reply with quote

It may help if you also post the two VSAM definitions, base cluster and AIX.
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Wed Apr 21, 2010 11:43 am
Reply with quote

Here's the Base Cluster definition -

DEFINE CLUSTER -
(NAME(USER.NONX.IRSCAEDD) -
RECORDSIZE(13 13) -
FREESPACE(20 20) -
BUFSPC(20480) -
CYL(200 100) -
SHAREOPTIONS(3 3) -
CISZ(4096) -
SPEED -
UNIQUE -
KEYS(13 0) -
VOLUME(TESTDA TESTDA TESTDA TESTDA TESTDA))
DATA (NAME(USER.NONX.IRSCAEDD.DATA)) -
INDEX (NAME(USER.NONX.IRSCAEDD.INDEX))


Here's the Alternate Index definition -

DEFINE ALTERNATEINDEX
(NAME(USER.NONX.IRSCAEDD.ALTNT)
RELATE(USER.NONX.IRSCAEDD)
KEYS(9 4)
REUSE
UPGRADE
CYLINDERS(200 100)
RECORDSIZE(13 53392)
SHAREOPTIONS(3 3)
VOLUMES(TESTDA TESTDA TESTDA TESTDA)
NONUNIQUEKEY
FREESPACE(25 25))
DATA (NAME(USER.NONX.IRSCAEDD.ALTNT.DATA)
CISZ(4096))
INDEX (NAME(USER.NONX.IRSCAEDD.ALTNT.INDEX)
CISZ(1024))
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Apr 21, 2010 4:27 pm
Reply with quote

Code:
SELECT AIRTAXID-MAST ASSIGN TO ADDRMSTR
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS AIR-KEY
ALTERNATE RECORD KEY IS
AIR-KEY-TAXID WITH DUPLICATES
FILE STATUS IS AIR-TAXID-STATUS.
The alternate record key must start in the 5th byte of the 01 within the FD -- you have it starting in byte 1.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Apr 21, 2010 4:31 pm
Reply with quote

"ALTERNATE RECORD KEY" "AIR-TAXID" had the same leftmost character position as that of the "RECORD KEY" for this file"
Instead of:
01 AIR-TAXID PIC 9(009).
Try:
01 FILLER.
05 FILLER.
10 FILLER X(004).
10 AIR-TAXID PIC 9(009).
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Thu Apr 22, 2010 10:31 am
Reply with quote

Hi,

When i gave the description as said above the program worked. But i guess there is some pblm with my alternate index VSAM. I guess the data isn't been populated correctly. Below are the details -

VSAM Base Definition -

DEFINE CLUSTER -
(NAME(USER.NONX.IRSCAEDD) -
RECORDSIZE(13 13) -
FREESPACE(20 20) -
BUFSPC(20480) -
CYL(200 100) -
SHAREOPTIONS(3 3) -
CISZ(4096) -
SPEED -
UNIQUE -
KEYS(13 0) -
VOLUME(TESTDA TESTDA TESTDA TESTDA TESTDA))
DATA (NAME(USER.NONX.IRSCAEDD.DATA)) -
INDEX (NAME(USER.NONX.IRSCAEDD.INDEX))

Alternate Index Definition -

DEFINE ALTERNATEINDEX
(NAME(USER.NONX.IRSCAEDD.ALTNT)
RELATE(USER.NONX.IRSCAEDD)
KEYS(9 4)
REUSE
UPGRADE
CYLINDERS(200 100)
RECORDSIZE(13 53392)
SHAREOPTIONS(3 3)
VOLUMES(TESTDA TESTDA TESTDA TESTDA)
NONUNIQUEKEY
FREESPACE(25 25))
DATA (NAME(USER.NONX.IRSCAEDD.ALTNT.DATA)
CISZ(4096))
INDEX (NAME(USER.NONX.IRSCAEDD.ALTNT.INDEX)

Data In VSAM Base:

0000000000000
0200001343759
0200001385475
0200001400574
0200001488448
0200001562520
0200001763339
0200001804739
0200002121478
0200002321112
0200002328618
0200002340680
0200002361790
0200002364223
0200002380897

Data In VSAM Alternate Index:

0000000000000000000000
0012694912001001269491
0013014160365001301416
0013298242001001329824
0013437590200001343759
0013808440434001380844
0013854750200001385475
0014005740200001400574
0014404131800001440413
00148844802000014884481728001488448
0015462161820001546216
0015625200200001562520
0015675850365001567585
0016268712001001626871
0017633390200001763339


Can you tell me why this occurs like this, please !
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Thu Apr 22, 2010 5:23 pm
Reply with quote

You've got problems with your alternate index definition, for one. The alternate index key length is defined in the AMS for Catalogs manual as:
Quote:
RECSZ = 5 + AIXKL + (n x BCKL)
so 5 + 9 + 13 * ??? is what the alternate index key length should be (where ??? is the maximum number of duplicates of the primary key you expect to have). 27 would be the minimum.
Back to top
View user's profile Send private message
Kumaresan.nk

New User


Joined: 22 Mar 2010
Posts: 31
Location: Chennai

PostPosted: Fri Apr 23, 2010 1:55 pm
Reply with quote

Hi,

I gave the RECZ as - 5+9+(100*13) = 1314.

DEFINE ALTERNATEINDEX -
(NAME(USER.NONX.IRSCAEDD.ALTNT) -
RELATE(USER.NONX.IRSCAEDD) -
KEYS(9 4) -
REUSE -
UPGRADE -
CYLINDERS(200 100) -
RECORDSIZE(13 1314) -
SHAREOPTIONS(3 3) -
VOLUMES(TESTDA TESTDA TESTDA TESTDA) -
NONUNIQUEKEY -
FREESPACE(25 25)) -

But still am getting the data populated in the Alternate Index dataset as in the previous case -

0000000000000000000000
0012694912001001269491
0013014160365001301416
0013298242001001329824
0013437590200001343759
0013808440434001380844
0013854750200001385475
0014005740200001400574
0014404131800001440413
00148844802000014884481728001488448
0015462161820001546216
0015625200200001562520
0015675850365001567585
0016268712001001626871
0017633390200001763339

Don't know why the data appears like this !
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Apr 23, 2010 2:01 pm
Reply with quote

reposting the same info will not lead anywhere
the AIX component has been populated properly
did You care to define also the PATH

anyway ... too much to be written to explain all the shebang of alternate indexes
see
www.simotime.com/cblalt01.htm
for a very clear explanation of the whole thing
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Apr 23, 2010 4:27 pm
Reply with quote

Quote:
Don't know why the data appears like this !
Exactly how do you expect the data to appear? Based on what you've told us so far, the alternate index data looks precisely as I would expect it to look.
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Error when install DB2 DB2 2
No new posts CLIST - Virtual storage allocation error CLIST & REXX 5
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Cobol file using index COBOL Programming 2
Search our Forums:

Back to Top