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
 
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 The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm

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