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

alternate index for esds in cobol program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Mon Jan 05, 2009 11:09 am
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

Superior Member


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

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

Hello,

You might like to check these links:

www.ibmmainframes.com/viewtopic.php?t=29269&highlight=esds+aix
www.ibmmainframes.com/viewtopic.php?t=34891&highlight=alternate
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Jan 15, 2009 6:15 pm
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

Moderator Emeritus


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

PostPosted: Thu Jan 15, 2009 9:57 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top