Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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: 7993
Location: Bellevue, IA

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: 7993
Location: Bellevue, IA

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: 7993
Location: Bellevue, IA

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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 1 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us