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
 
How to Read VSAM file using Partial key in Batch proogram

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

New User


Joined: 25 Apr 2005
Posts: 3
Location: bangalore

PostPosted: Fri Feb 16, 2007 1:11 pm    Post subject: How to Read VSAM file using Partial key in Batch proogram
Reply with quote

Hi,

Please suggest a suitable method to read a VSAM KSDS file using partial key.
The key is of 40 bytes, and I have only data upto 17 byes.
I am told not to repro top another file of 17 bytes, and to use only file with 40 bytes key.

this is needed through batch cobol program.

Answeres are needed ASAP., litle bit urgent.

any help regarding this is highly apprciated.
thank you.
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: Fri Feb 16, 2007 1:54 pm    Post subject:
Reply with quote

Babu,
Looking at your constrains the task seems to be a bit hard, k one way of accesing is by d3efining thre first 17 bytes as an alternate key for the KSDS for this u need to define an AIX , build that AIX and got to define a Path, if ya running this in prouction u have to get proper approvals to do this task, the other way is to read the file KSDS in a sequential way load all the data to a table by using occurs depending on the no. of rec. inside your KSDS and then using the INDEX of the table to access the records, if ya want to follow this approach the lrecl inside the KSDS should be fixed for the array declaration to be proper and this one is bit lengthy process and perfiormance wise not good one. the best one is by using an alternate index i think.



Cheer's,

Thamilzan.
Back to top
View user's profile Send private message
kanchetibabu

New User


Joined: 25 Apr 2005
Posts: 3
Location: bangalore

PostPosted: Fri Feb 16, 2007 2:38 pm    Post subject: Re: How to Read VSAM file using Partial key in Batch proogra
Reply with quote

Hi Thamilzan,
Thank you for your reply, i will try with the AIX.

regards.
if possible can u give the Alternate Key definition and AIX process
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 16, 2007 2:49 pm    Post subject: Re: How to Read VSAM file using Partial key in Batch proogra
Reply with quote

kanchetibabu wrote:
Please suggest a suitable method to read a VSAM KSDS file using partial key.
The key is of 40 bytes, and I have only data upto 17 byes.
I am told not to repro top another file of 17 bytes, and to use only file with 40 bytes key.
Is the 17 bytes part of the 40 byte key?
If so, COBOL will easily random read a KSDS file with a partial or "generic" key. Are you aware of this?
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: Fri Feb 16, 2007 3:03 pm    Post subject:
Reply with quote

Babu,
please find the sample creation of an AIX

Code:
//AMSJOB   JOB   (ACCTNO)
//DEFAIX1   EXEC     PGM=IDCAMS
//SYSPRINT    DD    SYSOUT =*
//SYSIN   DD    *
DEFINE AIX            -
   (NAME      (EMP.KSDS.DEPT.AIX)   -
   VOLUMES      (VS0101)   -
   RELATE      (EMP.KSDS.CLUSTER)   -
   UPGRADE            -
   CYLINDERS   (2 1)   -
   KEYS      (25 9)   -
   RECORDSIZE   (70 110)   -
   FREESPACE   (20 10)   -
   SHAREOPTIONS   (1)   -
   NONUNIQUEKEY   )      -
   DATA            -
   (NAME      (EMP.KSDS.DEPT.DATA))   -
   INDEX            -
   (NAME      (EMP.KSDS.DEPT.INDEX))   
/*


after running this u have build index i.e..

Code:
//AMSJOB   JOB   (ACCTNO)
//BLDIND   EXEC   PGM=IDCAMS
//SYSPRINT   DD      SYSOUT=*
//*DISP=OLD ensures exclusive use during BLDINDEX
//*execution
//EMPBASE   DD      DSN=EMP.KSDS.CLUSTER,DISP=OLD
//AUTHAIX   DD      DSN=EMP.KSDS.DEPT.AIX,DISP=OLD
//IDCUT1   DD      DSN=SORT.WORK.ONE,DISP=OLD
//IDCUT2   DD      DSN=SORT.WORK.TWO,DISP=OLD
//*To use different ddnames in place of IDCUT1 and
//*IDCUT2 add WORKFILES(ddname1,ddname2)
//*as a BLDINDEX parameter
//SYSIN   DD   *
BLDINDEX                     -
   INFILE      (EMPBASE)         -
   OUTFILE      (AUTHAIX)         -
   INTERNALSORT               -
   CATALOG   (VSAM.USERCAT)
/*
//*To use data set names directly use INDATASET and
//*OUTDATASET in place of INFILE and OUTFILE
//*respectively


then define a path

Code:
//AMSJOB    JOB   
//KSDSPTH1   EXEC    PGM=IDCAMS
//SYSPRINT   DD      SYSOUT=A
//SYSIN   DD      *
   DEFINE    PATH      -
   ( NAME       (EMP.KSDS.PATH1.DEPT)   -
     PATHENTRY    (EMP.KSDS.DEPT.AIX)   -
        UPDATE )
/*


phew... Quite a lot rite icon_rolleyes.gif


Cheer's,

Thamilzan.
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: Fri Feb 16, 2007 3:04 pm    Post subject:
Reply with quote

Bill,
Could u please throw some light on Generic key , and how can it be used.


Cheer's,

Thamilzan.
Back to top
View user's profile Send private message
kanchetibabu

New User


Joined: 25 Apr 2005
Posts: 3
Location: bangalore

PostPosted: Fri Feb 16, 2007 3:23 pm    Post subject: Re: How to Read VSAM file using Partial key in Batch proogra
Reply with quote

Thanks Thamilzan,

Hi Bill, can you please tell the process of Generic key reading.
yes it a part of 40 byte key. 17 are the 1 to 17 bytes of 40 byte key.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Fri Feb 16, 2007 3:31 pm    Post subject:
Reply with quote

prav_06 wrote:
Could u please throw some light on Generic key , and how can it be used.
Look at the START verb.
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 Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 0 Thu Nov 23, 2017 10:24 am
No new posts How to query MAXGENS of an existing P... Chuchulo Hatyzak JCL & VSAM 0 Wed Nov 22, 2017 10:23 pm
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm
No new posts unable to set RC = 4 when empty file migusd SYNCSORT 1 Tue Nov 21, 2017 1:21 am
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am

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