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

File Status 04


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

New User


Joined: 14 Oct 2022
Posts: 2
Location: USA

PostPosted: Fri Oct 14, 2022 8:51 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Sun Oct 16, 2022 1:11 am
Reply with quote

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
View user's profile Send private message
dhivyarg

New User


Joined: 14 Oct 2022
Posts: 2
Location: USA

PostPosted: Mon Oct 17, 2022 8:45 pm
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Oct 18, 2022 2:25 am
Reply with quote

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
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 FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top