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

VSAM File - VB


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

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Wed Jun 03, 2009 6:14 pm
Reply with quote

How to declare a Variable Block VSAM file in FD Section and FILE-CONTROL Section. I have declared as below and during reads Return Code 04 is thrown.

Code:

FILE-CONTROL.
SELECT FILEA  ASSIGN TO FILEA
                      ORGANIZATION IS INDEXED   
                      ACCESS IS SEQUENTIAL       
                      RECORD KEY IS FILEA-KEY     
                      FILE STATUS FILEA-STATUS.

FILE SECTION.
FD FILEA.   
COPY FILEACPY.



Kindly let me know
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 Jun 03, 2009 6:27 pm
Reply with quote

RETURN CODE 04 or FILE STATUS 04? There is a huge difference -- RETURN CODE 04 is set by your program and we cannot tell you a thing about what it means since it will be in your code. FILE STATUS 04 means your VSAM file read a record which is not the same length as the fixed length record your FD 01 specified -- so even though the physical file is variable your COBOL program treated it as fixed length. This usually happens because you have only one fixed-length 01 under your FD, or you have multiple 01s defined but they are all the same length.
Back to top
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Wed Jun 03, 2009 6:31 pm
Reply with quote

Thanks Robert for your quick reply.

Actually its FILE STATUS 04, and regarding the length of the file. It varies a from 36 - 20036 so we aren't able to define that much 01 under the FD.
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 Jun 03, 2009 6:35 pm
Reply with quote

Quote:
so we aren't able to define that much 01 under the FD.
No COBOL reason you couldn't, but you know your site. Try this:
Code:
FD FILEA         RECORD VARYING FROM 36 TO 20036 CHARACTERS.   
COPY FILEACPY.
YOU have to do something to tell COBOL you've got variable length records, as the default is based on the 01 level(s) under the FD, and your 01 obviously is fixed length.
Back to top
View user's profile Send private message
Itanium

Active User


Joined: 22 Jan 2006
Posts: 114
Location: India

PostPosted: Wed Jun 03, 2009 6:57 pm
Reply with quote

Thanks Bob. This worked icon_smile.gif
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 Jun 03, 2009 7:09 pm
Reply with quote

Glad to hear it worked ... but no "Bob" here ... just a Robert.
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 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
No new posts Access to non cataloged VSAM file JCL & VSAM 18
No new posts Need help for File Aid JCL to extract... Compuware & Other Tools 23
Search our Forums:

Back to Top