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 Profile Log in to check your private messages Log in
 
alternate index for esds in cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
inbasekarmani
Warnings : 2

New User


Joined: 20 Apr 2007
Posts: 13
Location: chennai

PostPosted: Mon Jan 05, 2009 10:58 am    Post subject: alternate index for esds in cobol program
Reply with quote

hi everybody,

plz fill up the blanks where i mentioned "?" symbol when i tried using following code.

Code:
 IDENTIFICATION DIVISION.             
 PROGRAM-ID. XYZ.                     
 ENVIRONMENT DIVISION.                 
 INPUT-OUTPUT SECTION.                 
 FILE-CONTROL.                         
     SELECT INFILE ASSIGN TO AS-DD1   
     ORGANIZATION IS SEQUENTIAL       
     ACCESS MODE IS SEQUENTIAL         
     ALTERNATE RECORD KEY IS ??  :?  (EMPNAME)   
     FILE STATUS IS FS1.               
 DATA DIVISION.                       
 FILE SECTION.                         
 FD INFILE.                           
 01 INREC.                             
    05 EMPNO  PIC X(5).               
    05 FILLER PIC X(2).     
   05 EMPNAME   PIC X(12).             
   05 FILLER PIC X(3).                 
   05 AGE    PIC 9(2).                 
   05 FILLER PIC X(2).                 
   05 SALARY PIC 9(5).                 
   05 FILLER PIC X(49).               
WORKING-STORAGE SECTION.               
77 FS1 PIC 9(2).                       
77 EMP PIC 9(2).                       
77 ABC PIC 9(5).                       
PROCEDURE DIVISION.                   
     PERFORM 1000-OPEN-PARA.           
     PERFORM 2000-READ-PARA.           
     PERFORM 3000-CLOSE-PARA.         
1000-OPEN-PARA.                       
     OPEN INPUT INFILE.               
     ACCEPT EMPNAME.                   
 2000-READ-PARA.                             
     READ INFILE  :? AT END  DISPLAY "END OF FILE"
     NOT AT END                               
         DISPLAY "NAME:" EMPNAME             
         DISPLAY "AGE:"  AGE                 
         DISPLAY "SALARY:"  SALARY           
     END-READ.                               
 3000-CLOSE-PARA.                             
     CLOSE INFILE.                           
     STOP RUN.



Edited: Please use BBcode when You post some code, that's rather readable, Thanks...Anuj
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jan 05, 2009 11:09 am    Post subject:
Reply with quote

Hello,

What happens when you try this?

AFAIK, you cannot use "alternate record key" with a sequential file.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Jan 05, 2009 12:32 pm    Post subject:
Reply with quote

Hello,

You might like to check these links:

http://www.ibmmainframes.com/viewtopic.php?t=29269&highlight=esds+aix
http://www.ibmmainframes.com/viewtopic.php?t=34891&highlight=alternate
http://www.ibmmainframes.com/viewtopic.php?t=36096&highlight=alternate
Back to top
View user's profile Send private message
inbasekarmani
Warnings : 2

New User


Joined: 20 Apr 2007
Posts: 13
Location: chennai

PostPosted: Thu Jan 15, 2009 4:59 pm    Post subject: Reply to: alternate index for esds in cobol program
Reply with quote

hi dick,

I tried for this but i get confused when writing the code what to be given for alternate key name. one of my friend told that we able to create esds but we cannot use it in batch programs. only its possible for online programs. please tell that the above statement is true or false.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8151
Location: East Dubuque, Illinois, USA

PostPosted: Thu Jan 15, 2009 6:15 pm    Post subject:
Reply with quote

The COBOL manual includes ALTERNATE RECORD KEY only in the definition of indexed files. Based on this, I do not believe batch COBOL programs can use an alternate index on an ESDS file.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Jan 15, 2009 9:57 pm    Post subject:
Reply with quote

Hello,

Has this esds been in production use for a long time? If this file is part of some new development, it may be better served with a ksds which could be read sequentially or randomly by any of the keys. . .
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. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Confusion b/w index and subscript Deepak kumar25 Mainframe Interview Questions 7 Thu Aug 31, 2017 6:50 am
No new posts ALPHABETIC check in COBOL vidyaa COBOL Programming 8 Thu Aug 17, 2017 7:13 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm

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