View previous topic :: View next topic
|
Author |
Message |
johngeorge
New User
Joined: 03 Aug 2006 Posts: 5
|
|
|
|
i have a ksds cluster, i had created the index file, record key is bookid, alternate record key is authorname. authorname is having duplicates. i want to retrieve the record corresponding to the authorname
say ramu. the author ramu had written two books. i want to retrieve all the details of those two books. how should i use the read statment? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I'm not sure i understand your requirement - sorry if i misunderstood.
Do you want to do this using the sort? If so, you can use an INCLUDE. You'll pass the file retrieving only those records that match the value INCLUDed.
If the vsam file is very large, i'd suggest using a cobol program that would "start" at authorname and only process the records for that author. |
|
Back to top |
|
|
prav_06 Warnings : 1 Active User
Joined: 13 Dec 2005 Posts: 154 Location: The Netherlands
|
|
|
|
John,
Try to access the KSDS in a Dynamic mode by using Author name as alternate record key an use the start verb , u r functionality would be achieved
Syntax would be
Code: |
EQUAL TO
START file-name KEY is GREATER THAN dataname
NOT LESS THAN
NOT >
[INVALID KEY imperative statement] |
Thamilzan. |
|
Back to top |
|
|
smiley Warnings : 1 New User
Joined: 08 Feb 2006 Posts: 27
|
|
|
|
is the author name a part of your key?? if that is the case u can go for a generic read.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Yes, there are several coding solutions, but i'm still not sure if code is ok or TS wants this via sort. This IS the sort forum. . . . |
|
Back to top |
|
|
Bitneuker
CICS Moderator
Joined: 07 Nov 2005 Posts: 1104 Location: The Netherlands at Hole 19
|
|
|
|
dick scherrer wrote: |
Hello,
Yes, there are several coding solutions, but i'm still not sure if code is ok or TS wants this via sort. This IS the sort forum. . . . |
Dick, not any more. It's moved to cobol |
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
Code: |
ID DIVISION.
PROGRAM-ID. XXX.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT FILE1 ASSIGN TO DD1
ORGANISATION IS INDEXED
ACCESS MODE IS RANDOM
RKEY IS BOOKID
ALTERNATE KEY IS AUTONAME WITH DUPLICATE
FILE STATUS IS FS1.
DATA DIVISION.
FILE SECTION.
01 MASTER
O2 X PIC X(80).
WORKING-STORAGE SECTION.
77 FS1 PIC 99.
PROCEDURE DIVISION
MAINPARA.
PERFORM OPENPARA.
PERFORM READ-PARA.
PERFORM START-PARA.
PERFORM CLOSE-PARA.
OPENPARA.
OPEN INPUT FILE1.
READ-PARA.
MOVE RAMU TO AUTONAME.
IF INVALID KEY DISPLAY "THIS IS INVALID RECORD"
IN NOT INVALID
START-PARA.
START AUTONAME.
READ FILE1 NEXT
DISPLAY MASTER.
CLOSE-PARA.
CLOSE-FILE1. |
|
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
AND FOR JCL
//CNEW444C JOB (A1234,345),ZAHIR,MSGLEVEL-= (1,1),PRTY=14,NOTIFY=&SYSUID
//S1 EXEC PGM=IGYWCLG
//SYSPRING DD SYSOUT=*
//DD1 DD DSN=CLUSTERNAME, DISP=SHR
//DD11 DD DSN=PATHNAME
//
AND RUN
FROM SACHIN BORASE
PUNE |
|
Back to top |
|
|
|