IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

sample program for dynamic access of VSAM file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jwell rymbei

New User


Joined: 14 Dec 2005
Posts: 22
Location: India

PostPosted: Fri Jan 20, 2006 4:29 pm
Reply with quote

Hi
Can anybody send me sample cobol program for dynamic access of VSAM file..
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jan 20, 2006 5:50 pm
Reply with quote

hi jwell rymbei,

U have not mentioned for read or rite.. any how i have written for write. U can refer this code and u can develop the rest. hope this code will help more...

Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. XX
ENVIRONMENT DIVISION.
INPUT-OUTPUT DIVISION.
FILE-CONTROL.
          SELECT xx ASSIGN TO DD1
          ORGANIZATION IS INDEXED
          ACCESS MODE IS DYNAMIC
          RECORD KEY IS .....
          FILE STATUS IS FS1.

DATA DIVISION.
FILE SECTION.
FD xx
01 pp
..

...
WORKING-STORAGE SECTION.
...
PROCEDURE DIVISION.
PROC1.
OPEN OUTPUT xx.
MOVE VARNAME TO pp.
WRITE pp INVALID KEY DISPLAY "KEY: " xxx.
CLOSE xx.
STOP RUN.
Back to top
View user's profile Send private message
jwell rymbei

New User


Joined: 14 Dec 2005
Posts: 22
Location: India

PostPosted: Mon Jan 23, 2006 1:24 pm
Reply with quote

Thanks k.a.khamaurutheen
Back to top
View user's profile Send private message
jwell rymbei

New User


Joined: 14 Dec 2005
Posts: 22
Location: India

PostPosted: Mon Jan 23, 2006 3:42 pm
Reply with quote

Hi K.A,
Do you have any sample source to read a vsam indexed file. I need to read an indexed file first randomly then keep on reading until the record gets changed. Let say I have a file whose key field is employee code and sequence number. Now for a single policy the file can have multiple records (note policy will remain same but sequnce number will be different). Now an employee code will be passed to the program and it should write all the records related that particular employee. icon_question.gif
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Mon Jan 23, 2006 3:56 pm
Reply with quote

Hi jwell rymbei,

Hope u might have completed any mainframe course. so u may go thru that materials so that u will get the solution easily.....
Back to top
View user's profile Send private message
sbalajibe

New User


Joined: 15 Aug 2005
Posts: 62

PostPosted: Tue Jan 24, 2006 9:02 am
Reply with quote

Hi jwell rymbei,

answer to u r question is use control break logic in u r program

read the record from a file check for u r key
then read all the records till there is a change in the key value


thanks
Balaji
Back to top
View user's profile Send private message
jwell rymbei

New User


Joined: 14 Dec 2005
Posts: 22
Location: India

PostPosted: Tue Jan 24, 2006 11:31 am
Reply with quote

Hi all,
Thanks for the help...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Using API Gateway from CICS program CICS 0
Search our Forums:

Back to Top