Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
VSAM File - VB

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: VSAM File - VB
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: 8280
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 03, 2009 6:27 pm    Post subject:
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    Post subject:
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: 8280
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 03, 2009 6:35 pm    Post subject:
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    Post subject:
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: 8280
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 03, 2009 7:09 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts VSAM - Accessing beyond record size Benchwarmer JCL & VSAM 6 Wed Apr 11, 2018 9:20 pm
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us