View previous topic :: View next topic
|
Author |
Message |
mosinjamadar
New User
Joined: 26 Sep 2007 Posts: 42 Location: pune
|
|
|
|
Hi All
I want to read KSDS file using alternate key which I have defined on KSDS but I am not able to access using alternate kye its giving file status 23
Kindly let me know what mistake i am doing
following is my code
Code: |
ID DIVISION.
PROGRAM-ID. KSDAIX.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT EMPDTA ASSIGN TO DDIDX
ORGANIZATION IS INDEXED
ACCESS MODE IS RANDOM
RECORD KEY IS EMP-NUM
ALTERNATE KEY IS EMP-DEPT WITH DUPLICATES
FILE STATUS IS WF-KSDS-STATUS.
DATA DIVISION.
FILE SECTION.
FD EMPDTA.
01 EMPDTA-REC.
03 EM-SR PIC 9(1).
03 EMP-NUM PIC 9(5).
03 EMP-NAME PIC X(10).
03 EMP-DEPT PIC X(10).
03 FILLER PIC X(54).
WORKING-STORAGE SECTION.
01 WS-DATA.
03 WF-KSDS-STATUS PIC X(2).
03 WS-CNT PIC 9(2).
03 WF-EOF-FILE PIC X(1).
88 WF-EOF VALUE 'Y'.
88 WF-NOT-EOF VALUE 'N'.
PROCEDURE DIVISION.
A00-MAIN SECTION.
PERFORM A010-INITIAL
PERFORM B020-PROCESS
A00-MAIN-EXIT SECTION.
EXIT.
A010-INITIAL SECTION.
OPEN INPUT EMPDTA
IF WF-KSDS-STATUS > '00'
DISPLAY 'ERROR IN OPENING' WF-KSDS-STATUS
END-IF
move 'globalbusn' to EMP-DEPT
.
A010-INITIAL-EXIT SECTION.
EXIT.
B020-PROCESS SECTION.
PERFORM C010-READ-KSDS UNTIL WF-KSDS-STATUS = '10'
STOP RUN
.
B020-PROCESS-EXIT SECTION.
EXIT.
C010-READ-KSDS SECTION.
READ EMPDTA
INVALID KEY
DISPLAY 'INVALID KEY' WF-KSDS-STATUS
MOVE '10' TO WF-KSDS-STATUS
.
C010-READ-KSDS-EXIT SECTION.
EXIT.
|
following is base cluster content
1 23456 mosinjamadbankandcar
2 23457 mosinjamadbankandcar
2 23458 1234611111bankandcar
2 23459 abcd123456globalbusn
2 23460 mosinjamadglobalbusn
2 23461 mosinjamadinsurance
following is alternate index file content
bankandcar 234562345723458
globalbusn 2345923460
insurance 23461 |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Code: |
READ EMPDTA
KEY IS EMP-DEPT
INVALID KEY |
The default is to read by the primary key, which you didn't initialize. |
|
Back to top |
|
|
mosinjamadar
New User
Joined: 26 Sep 2007 Posts: 42 Location: pune
|
|
|
|
Hi
The solution you have mentioed is not working please specify if you have any other solution
Regards,
Mosin |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Saying something is not working provides us nothing to help you with. What is the file status code? Are there any other messages? What does your JCL look like that is executing KSDAIX? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
solution you have mentioed is not working |
TS does not bother to insure his posts are accurate.
more than likely the TS did not bother to fully implement Robert's suggestion.
But, the JCL for the STEP is also necessary, especially since he probably codes as sloppily and haphazard as he posts. |
|
Back to top |
|
|
|