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

How to Read VSAM file using Partial key in Batch proogram


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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
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: 3156
Location: Tucson AZ

PostPosted: Fri Feb 16, 2007 2:49 pm
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
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
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
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: 3156
Location: Tucson AZ

PostPosted: Fri Feb 16, 2007 3:31 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top