Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Accessing thru Alternate key in ksds

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
johngeorge

New User


Joined: 03 Aug 2006
Posts: 5

PostPosted: Tue Feb 20, 2007 11:33 am    Post subject: Accessing thru Alternate key in ksds
Reply with quote

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
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Tue Feb 20, 2007 10:39 pm    Post subject:
Reply with quote

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
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Wed Feb 21, 2007 11:06 am    Post subject:
Reply with quote

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
View user's profile Send private message
smiley
Warnings : 1

New User


Joined: 08 Feb 2006
Posts: 27

PostPosted: Wed Feb 21, 2007 1:00 pm    Post subject:
Reply with quote

is the author name a part of your key?? if that is the case u can go for a generic read..
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Wed Feb 21, 2007 7:54 pm    Post subject:
Reply with quote

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. . . . icon_confused.gif
Back to top
View user's profile Send private message
Bitneuker

CICS Moderator


Joined: 07 Nov 2005
Posts: 1105
Location: The Netherlands at Hole 19

PostPosted: Wed Feb 21, 2007 10:06 pm    Post subject:
Reply with quote

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. . . . icon_confused.gif


Dick, not any more. It's moved to cobol icon_wink.gif
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Fri Feb 23, 2007 11:54 am    Post subject:
Reply with quote

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
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Fri Feb 23, 2007 11:59 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Accessing CICS tran with map from JCL... navdeepaggarwal CICS 5 Tue Oct 03, 2017 6:15 pm
No new posts Accessing first bit of PD value rajatbagga DFSORT/ICETOOL 11 Wed May 03, 2017 6:03 am
No new posts Access SQLCA fields inside a stored p... gangapd DB2 6 Thu Oct 27, 2016 10:20 am
No new posts Several errors during building altern... Andi1982 JCL & VSAM 11 Wed Jul 06, 2016 7:39 pm
No new posts Drop building Alternate Index for a p... bhavin.mehta JCL & VSAM 6 Mon Jul 04, 2016 3:47 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us