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

Explain Relative File Concept in COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 3156
Location: Tucson AZ

PostPosted: Sun Mar 04, 2007 5:22 am
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
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: 3156
Location: Tucson AZ

PostPosted: Sun Mar 04, 2007 5:50 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top