View previous topic :: View next topic
|
Author |
Message |
dhivyarg
New User
Joined: 14 Oct 2022 Posts: 2 Location: USA
|
|
|
|
FILE STATUS :04
Scenario: Created Alt index.. Reading the VSAM file with Alt key (direct read, no start because i have full key).. the file won't have duplicates
Program returns error code 04. Can you help me what's wrong. Thanks for the help!
Program:
Input File 1 - Sequential file in sorted order
Input File 2 - VSAM 256 byte (Records in sorted order before Repro) Primary key 28 + Alt key 28 + Data & Filler 200
AIX Definition
DEFINE -
AIX -
(NAME(Vsam File.AIX1) -
RELATE(Vsam File) -
RECSZ(256 256) -
KEYS(28 28) -
DATACLAS(EXTENDED) -
FREESPACE(1 0) -
SPEED -
UNIQUE -
NONUNIQUEKEY -
UPGRADE -
SHR(2 3)) -
File control
SELECT FILE2 ASSIGN TO FILE2
ORGANIZATION IS INDEXED
ACCESS MODE IS DYNAMIC
RECORD KEY IS Primary KEY
ALTERNATE RECORD KEY IS Alternate key
WITH DUPLICATES
FILE STATUS IS WS-VSAM-STAT.
FD FILE2
BLOCK CONTAINS 0 RECORDS
LABEL RECORDS ARE STANDARD.
01 FILE2-REC.
05 Primary-KEY PIC X(28).
05 Alternate -key PIC X(28).
05 DATA PIC X(200).
JCL
//STEP40 EXEC PGM=PGM1
//******************************************************
//FILE1 DD DSN=File1
// DISP=SHR
//FILE2 DD DSN=File2 (cluster),DISP=SHR
//FILE21 DD DSN=File 2 (path), |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
You need to find a copy of the IBM Redbook VSAM Demystified and read it from the start. You completely do NOT understand how VSAM alternate indexes work. The record size for an alternate index is defined as some overhead (5 bytes) plus the primary key length plus some multiple of the alternate index key length (the multiple depends upon how many duplicates you expect). So your AIX record length (assuming you allow 100 duplicates) would be 5 + 28 + 28 or 61 minimum and 5 + 28 + 100*28 or 2833 maximum so RECSZ(61,2833) is what you should be using.
My guess would be that you exceeded 256 bytes by hitting the 8th duplicate primary key and hence got the 04 file status code. |
|
Back to top |
|
|
dhivyarg
New User
Joined: 14 Oct 2022 Posts: 2 Location: USA
|
|
|
|
Thanks for your reply!
In my case Alt Index won't have duplicates.. I tried RECSZ(61 61) already, also tried RECSZ(61 2833) now.
Both gave 04 error |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
If your alternate index doesn't have duplicates, then RECSZ(61 61) will suffice. However, your DEFINE has NONUNIQUEKEY which is telling the system that you DO have duplicate keys. It sounds like the problem could be that you have base data set records that are not 256 bytes long. |
|
Back to top |
|
|
|