View previous topic :: View next topic
|
Author |
Message |
Kumaresan.nk
New User
Joined: 22 Mar 2010 Posts: 31 Location: Chennai
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
It may help if you also post the two VSAM definitions, base cluster and AIX. |
|
Back to top |
|
|
Kumaresan.nk
New User
Joined: 22 Mar 2010 Posts: 31 Location: Chennai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
"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 |
|
|
Kumaresan.nk
New User
Joined: 22 Mar 2010 Posts: 31 Location: Chennai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Kumaresan.nk
New User
Joined: 22 Mar 2010 Posts: 31 Location: Chennai
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
|