I tried to write records in KSDS using COBOL program but unable to write records through COBOL program.I am accepting values through RUN JCL and after writing the records in COBOL pgm, I am reading the file and displaying the records which is showing in SYSOUT but not available in KSDS after opening KSDS file.Can any one tell me how to write a records in a KSDS file using COBOL program? what is abc.dat file use and extension.
Joined: 06 Jun 2008 Posts: 8195 Location: East Dubuque, Illinois, USA
Use the WRITE command.
You need to provide more information:
which version of COBOL (you can find this at the top of any page of the compile listing)?
what is the file status code for the open of the KSDS?
what is the file status code for the write?
what does the SELECT and OPEN statements look like?
what does the JCL DD statement for your KSDS file look like?
Post this data (using BBcode to make it readable) so we can see what's going on.
what is abc.dat file use and extension.
What does this mean? Mainframe files do not have extensions.
When you use the IDCAMS utility to DEFINE the VSAM file with a KSDS organization, there are two parts to the VSAM file that are created. The first holds the data and the next holds the index that is used to point to different parts of the DATA portion. Some installations create files with a .DAT and a .IDX node. These are parts of the name and not EXTENSIONS as you know them from WINDOWS files.
If you try to write records to a KSDS VSAM file and the file has just been created with IDCAMS and has no records in the file, you MUST use the OPEN OUTPUT file statement. If the file has existing records in it, then you must open the file with the OPEN I-O file statement.