Hi,
I would like to know how do we find out that the programis using VSAM file?
Thanks
Radhika
Cobol-VSAM question
Moderators: dbzTHEdinosauer, Moderator Group
This is the way.
Hi,
If it is using a KSDS then the SELECT statement would look like as shown below:
HTH.
If it is using a KSDS then the SELECT statement would look like as shown below:
Code: Select all
SELECT I-XXXXXXX ASSIGN TO XXXVSAM
ORGANIZATION IS INDEXED
ACCESS IS RANDOM
RECORD KEY IS XXXXXX-KEY.
Arr Bee
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)
-------------
?My joy in learning is partly that it enables me to teach? - Seneca(Roman philosopher, mid-1st century AD)
-
- Moderator
- Posts: 1625
- Joined: Sat Aug 09, 2008 9:02 am
- Location: Mumbai, India
Or some thing like this might needs to be remembered:
Changes in the ENVIRONMENT DIVISION:
ddname the ddname of the VSAM file being accessed
type specifies the order that records have been stored in
access specifies how records are going to be processed
key1 specifies the FD field name for the primary key field KSDS only
value in the key must be unique
key2 field in working storage that a value will be moved to prior to a READ/WRITE RRDS only used with RANDOM or DYNAMIC access
field1 PIC XX field in working storage that will be used by COBOL to indicate the result of an OPEN, CLOSE, READ, or WRITE 00 success / non-zero failure
field2 6 byte return code that is supplied if field1 is not 00
Changes in the DATA DIVISION:
VSAM records are not labeled, therefore the LABEL RECORDS ARE... clause is treated as a comment, though it is required.
VSAM records are not blocked, therefore the BLOCK CONTAINS... clause should not be specified.
Changes in the PROCEDURE DIVISION:
Opening a file:
I-O file that will be read from and written to
EXTEND file that will have records added to the end sequential file only
You can now test whether the files opened correct by testing the value placed in the FILE STATUS IS variable.
Closing a file:
Same as before but you can now test if the close was successful.
Changes in the ENVIRONMENT DIVISION:
Code: Select all
SELECT file-name ASSIGN TO ddname
ORGANIZATION IS type
ACCESS MODE IS access
RECORD KEY IS key1 / RELATIVE KEY IS key2
FILE STATUS IS field1 [field2].
Code: Select all
KSDS, RRDS format: DA-ddname
ESDS format: DA-AS-ddname
Code: Select all
SEQUENTIAL -- records are positioned in the order in which they were originally loaded (ESDS)
INDEXED -- records are positioned according to their index field (KSDS)
RELATIVE -- records are positioned according to their relative record number (RRDS)
Code: Select all
SEQUENTIAL -- read/write in sequential order
RANDOM -- read/write in a user specified order
DYNAMIC -- read/write in sequential, random, or both
key1 specifies the FD field name for the primary key field KSDS only
value in the key must be unique
key2 field in working storage that a value will be moved to prior to a READ/WRITE RRDS only used with RANDOM or DYNAMIC access
field1 PIC XX field in working storage that will be used by COBOL to indicate the result of an OPEN, CLOSE, READ, or WRITE 00 success / non-zero failure
field2 6 byte return code that is supplied if field1 is not 00
Code: Select all
01 VSAM-STATUS-CODES.
05 VSAM-RETURN-CODE PIC 9(2) COMP.
05 VSAM-FUNCTION-CODE PIC 9 COMP.
05 VSAM-FEEDBACK-CODE PIC 9(3) COMP.
VSAM records are not labeled, therefore the LABEL RECORDS ARE... clause is treated as a comment, though it is required.
VSAM records are not blocked, therefore the BLOCK CONTAINS... clause should not be specified.
Changes in the PROCEDURE DIVISION:
Opening a file:
Code: Select all
OPEN INPUT file-name.
OUTPUT
I-O
EXTEND
EXTEND file that will have records added to the end sequential file only
You can now test whether the files opened correct by testing the value placed in the FILE STATUS IS variable.
Closing a file:
Same as before but you can now test if the close was successful.
Regards,
Anuj
Anuj
FREE TUTORIALS
Tutorials
Free tutorials from mainframegurukul
- JCL Tutorial
Covers all important JCL concepts. - Cobol Tutorial
This tutorials covers all Cobol Topics from STRING to COMP-3. - DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. - SORT Tutorial
This Tutorial covers all important aspects of DFSORT with examples - CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page