View previous topic :: View next topic
|
Author |
Message |
jwell rymbei
New User
Joined: 14 Dec 2005 Posts: 22 Location: India
|
|
|
|
Hi
Can anybody send me sample cobol program for dynamic access of VSAM file.. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
|
jwell rymbei
New User
Joined: 14 Dec 2005 Posts: 22 Location: India
|
|
|
|
Thanks k.a.khamaurutheen |
|
Back to top |
|
|
jwell rymbei
New User
Joined: 14 Dec 2005 Posts: 22 Location: India
|
|
|
|
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. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
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 |
|
|
sbalajibe
New User
Joined: 15 Aug 2005 Posts: 62
|
|
|
|
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 |
|
|
jwell rymbei
New User
Joined: 14 Dec 2005 Posts: 22 Location: India
|
|
|
|
Hi all,
Thanks for the help... |
|
Back to top |
|
|
|