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

[Solved]Prbolem while reading through Alternate index


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gigs

New User


Joined: 08 Aug 2005
Posts: 27
Location: USA

PostPosted: Mon Sep 19, 2005 7:23 pm
Reply with quote

My prob is I read all empl file record then whose empl-sal is greather than 10,000 only those record will go into out put.
SELECT EMPL-FILE ASSIGN TO IDDNAM1
ORGANIZATION IS INDEXED
ACCESS IS SEQUENTIAL
RECORD KEY IS EMPL-ID
STATUS IS EMPL-STAT.
SELECT DEPT-FILE ASSIGN TO IDDNAM2
ORGANIZATION IS INDEXED
ACCESS IS RANDOM
RECORD KEY IS DEPT-NO
ALTERNATE RECORD KEY IS DEPT-EMPID
WITH DUPLICATES
STATUS IS DEPT-STAT.

FD EMPL-FILE.
01 EMPL-FILE-REC.
05 EMPL-ID PIC 9(06).
05 EMPL-NAME PIC X(20).
05 EMPL-DOB PIC 9(08).
05 EMPL-SAL PIC 9(8)V99.


FD DEPT-FILE.
01 DEPT-FILE-REC.
05 DEPT-NO PIC 9(06).
05 DEPT-NAME PIC X(10).
05 DEPT-LOC PIC X(10).
05 DEPT-EMPID PIC 9(6). ( Alternate index )

Out put should look like this
DEPERTMENT NAME EMPLOYEE ID EMPLOYEE NAME SALARY
Kolkata 111111 SUMANTA SOREN 11111111.11
Kolkata 333333 JOHN MATHEWS 33333333.33
Delhi 444444 PAUL RICHARD 44444444.44

but giving as
DEPERTMENT NAME EMPLOYEE ID EMPLOYEE NAME SALARY
0 111111 SUMANTA SOREN 11111111.11
0 333333 JOHN MATHEWS 33333333.33
0 444444 PAUL RICHARD 44444444.44


I am reading dept file as
MOVE EMPL-ID TO DEPT-EMPID
IF WS-EMPL-EXISTS = 'Y'
READ DEPT-FILE KEY IS DEPT-EMPID
INVALID KEY
DISPLAY ' DEPT STATUS :' DEPT-STAT
END-READ
END-IF.

I have included in jcl
//IDDNAM1 DD DSN=U122949.VSAM.EMPL,
// DISP=SHR
//IDDNAM2 DD DSN=U122949.VSAM.DEPT,
// DISP=SHR
//IDDNAM21 DD DSN=U122949.VSAM.DEPT.AIX.PATH,
// DISP=SHR



In spool it gives
DEPT STATUS :23
DEPT ID :



EMPL-FILE :
111111SUMANTA SOREN 080219811111111111
222222SUSANTA PAL 101019800000002222
333333JOHN MATHEWS 210319803333333333
444444PAUL RICHARD 170719794444444444

DEPT-FILE :
555555merket kolkata 111111
666666insurence kolkata 222222
777777pension delhi 444444
Back to top
View user's profile Send private message
gigs

New User


Joined: 08 Aug 2005
Posts: 27
Location: USA

PostPosted: Wed Sep 21, 2005 4:19 pm
Reply with quote

I have solve the problem


I have wrongly define the alternatekey cluster
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 Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Cobol file using index COBOL Programming 2
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts Rexx program reading a DSN then write... CLIST & REXX 4
Search our Forums:

Back to Top