View previous topic :: View next topic
|
Author |
Message |
inbasekarmani Warnings : 2 New User
Joined: 20 Apr 2007 Posts: 13 Location: chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
What happens when you try this?
AFAIK, you cannot use "alternate record key" with a sequential file. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
inbasekarmani Warnings : 2 New User
Joined: 20 Apr 2007 Posts: 13 Location: chennai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|