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
 
Explain Relative File Concept in COBOL

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

New User


Joined: 01 Mar 2007
Posts: 6
Location: Chennai

PostPosted: Thu Mar 01, 2007 10:54 pm    Post subject: Explain Relative File Concept in COBOL
Reply with quote

Hi All,
Could any one Help me ?
I need Relative file Concepts and If possible Please send me a simple program .


Regards,
Sakthivel Janarthanan
Back to top
View user's profile Send private message

sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Sun Mar 04, 2007 5:14 am    Post subject:
Reply with quote

The relative file concept comes when you want use key as relative record number,
the relative file consist of slotes i.always fixed, the maximum and average(minimum) record size must be same
there can following operation possible with RRDS
1] Deletion
2] insertion
3] updation
4] write
5]read
the access mode are 1]random
2]dynamic
3]sequential
the relative file organisation is fatser than other organisation but only limit is the key is not part of file i.e. not included in field
it always star from 1
for example.the relative mostly you can use in telephone exchane where the the numeric no is key
i given you one simpe programe for read the relative file
Code:
ID DIVISION.
                         PROGRAME-ID. WWW.
                         ENVIRONMENT DIVISION.
                         INPUT-OUTPUT SECTION.
                         FILE-CONTROL.
                              SELECT FILE1 ASSIGN TO DD1
                              ORGANIZATION IS RELATIVE
                              ACCESS MODE IS SEQUENTIAL
                              RELATIVE KEY IS RKEY
                              FILE STATUS FS1.
                         DATA DIVISION.
                         FILE SECTION.
                         FD FILE1.
                         01 MASTER.
                              02 X PIC X(80).
                         WORKING-STORAGE SECTION.
                          77 FS1 PIC 9(2).
                          PROCEDURE DIVISION.
                               OPEN INPUT FILE1.
                               READ FILE1.
                                IF FS1=0
                                DISPLAY MASTER.
                                CLOSE FILE1.

FROM -
SACHIN BORASE
PUNE
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Mar 04, 2007 5:22 am    Post subject:
Reply with quote

sachin_star3 wrote:
1] Deletion
It has been a while, I can't remember how to delete from an RRDS, could you help?
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Sun Mar 04, 2007 5:45 am    Post subject:
Reply with quote

deletion from RRDS Means delete the record the slot never deleted
i give you programe
Code:
ID DIVISION
                                    PROGRAME-ID. VVV.
                                    ENVIRONMENT DIVISION.
                         INPUT-OUTPUT SECTION.
                         FILE-CONTROL.
                              SELECT FILE1 ASSIGN TO DD1
                              ORGANIZATION IS RELATIVE
                              ACCESS MODE IS SEQUENTIAL
                              RELATIVE KEY IS RKEY
                              FILE STATUS FS1.
                         DATA DIVISION.
                         FILE SECTION.
                         FD FILE1.
                         01 MASTER.
                              02 X PIC X(80).
                         WORKING-STORAGE SECTION.
                          77 FS1 PIC 9(2).
                          PROCEDURE DIVISION.
                               OPEN I-O FILE1.
                               READ FILE1.
                               IF FS1=0
                               DELETE FILE1.
                                DISPLAY MASTER.
                                CLOSE FILE1.


FOR PARTICULAR RECORD DELETION
Code:
 ID DIVISION
                                    PROGRAME-ID. VVV.
                                    ENVIRONMENT DIVISION.
                         INPUT-OUTPUT SECTION.
                         FILE-CONTROL.
                              SELECT FILE1 ASSIGN TO DD1
                              ORGANIZATION IS RELATIVE
                              ACCESS MODE IS SEQUENTIAL
                              RELATIVE KEY IS RKEY
                              FILE STATUS FS1.
                         DATA DIVISION.
                         FILE SECTION.
                         FD FILE1.
                         01 MASTER.
                              02 X PIC X(80).
                         WORKING-STORAGE SECTION.
                          77 FS1 PIC 9(2).
                          PROCEDURE DIVISION.
                          MAINPARA.
                                  PERFORM OPEN-PARA.
                                  PERFORM READ-PARA UNTIL FS1 NOT = 0.
                                  PERFORM CLOSE-PARA.
                           OPEN-PARA.
                                 OPEN I-O FILE1.
                            READ-PARA.
                                  MOVE 03 TO RKEY.
                                  READ FILE1.
                                  DELETE MASTER.
                                  DISPLAY MASTER.           
                                  CLOSE FILE1.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Mar 04, 2007 5:50 am    Post subject:
Reply with quote

sachin_star3 wrote:
deletion from RRDS Means delete the record the slot never deleted
OK, so the slot does not get deleted, but the record does? If the slot is still there, how do you know that the record is not?
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Sun Mar 04, 2007 12:41 pm    Post subject:
Reply with quote

if we want to check the slote is empty or not by using
1] put PRINT CH IDS(/) infront of that RRDS file.
or 2] use TSO DITTO in tso command prompt
3] by using sequential reading in cobol progrm

frm -sachin borase
pune
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
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am

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