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
 

 

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
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us