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
 

 

Need an Example Program to use VSAM KSDS File Organization

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Thalloju

New User


Joined: 25 May 2005
Posts: 1

PostPosted: Wed May 25, 2005 10:20 am    Post subject: Need an Example Program to use VSAM KSDS File Organization
Reply with quote

I want cobol file programming methods. Especially using VSAM KSDS organization methods.
Back to top
View user's profile Send private message

jkbytes

Active User


Joined: 19 Feb 2005
Posts: 141
Location: South Africa

PostPosted: Wed May 25, 2005 10:54 am    Post subject: Re: File programming
Reply with quote

hi,

I guess this small Example program may help you in understanding more about Cobol vsam programming.


ADDING/INSERTING RECORDS FROM SEQ-->KSDS [key (3 0)]

Code:
 IDENTIFICATION DIVISION.                 
 PROGRAM-ID. COBOADD.                     
 ENVIRONMENT DIVISION.                   
 INPUT-OUTPUT SECTION.                   
 FILE-CONTROL.                           
     SELECT IN-FILE ASSIGN TO DD1         
     ORGANIZATION IS SEQUENTIAL           
     ACCESS MODE IS SEQUENTIAL.           
     SELECT OUT-FILE ASSIGN TO DD2       
     ORGANIZATION IS INDEXED             
     RECORD KEY IS ONO                   
     ACCESS MODE IS DYNAMIC               
     FILE STATUS IS ST.                   
 DATA DIVISION.                           
 FILE SECTION.                           
 FD IN-FILE.                   
 01 IN-REC.                     
    02 WNO PIC X(3).           
    02 WNAME PIC X(10).         
    02 WADDR PIC X(15).         
    02 FILLER PIC X(52).       
 FD OUT-FILE.                   
 01 OUT-REC.                   
    02 ONO PIC X(3).           
    02 ONAME PIC X(10).         
    02 OADDR PIC X(15).         
    02 FILLER PIC X(52).       
 WORKING-STORAGE SECTION.       
 01 EOF PIC X.                 
 77 ST PIC 99.                 
 PROCEDURE DIVISION.           
 MAIN-PARA.                     
     OPEN INPUT IN-FILE         
           I-O OUT-FILE.                                     
     DISPLAY ST.                                             
     PERFORM READ-PARA UNTIL EOF = 'Y'.                   
     CLOSE IN-FILE.                                       
     CLOSE OUT-FILE.                                       
     DISPLAY ST.                                           
     STOP RUN.                                             
READ-PARA.                                               
       READ IN-FILE INTO OUT-REC AT END MOVE 'Y' TO EOF. 
       IF EOF NOT EQUAL TO 'Y'                           
         WRITE OUT-REC                                   
         DISPLAY ST                                       
         DISPLAY OUT-REC                                 
       END-IF.                                   



Quote:
OUTPUT

INPUT IN SEQ
108TEJUUUU BANGLOREE
114VINDHYAA TRIVANDRUM

OUTPUT IN KSDS
KEY OF RECORD - 101
101JAIKUM KONNIIIIII ......................................
KEY OF RECORD - 102
102PRIYAA PATHANAMTHITTA ......................................
KEY OF RECORD - 105
105ANURAG BANGLORE ......................................
KEY OF RECORD - 107
107PRADEEP BAHRAINNN
KEY OF RECORD - 108
108TEJUUUU BANGLOREE ......................................
KEY OF RECORD - 110
110ABHILASH MUMBAIIII
KEY OF RECORD - 114
114VINDHYAA TRIVANDRUM ......................................
IDC0005I NUMBER OF RECORDS PROCESSED WAS 7
***
OUTPUT IN SPOOL
00
00
108TEJUUUU BANGLOREE
00
114VINDHYAA TRIVANDRUM
00


Thanks & regards,

JKBYTES
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