Date: Sat, 13 Nov 1999 14:10:46 -0000
Reply-To: Ron Stow <ronstow@BTINTERNET.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Ron Stow <ronstow@BTINTERNET.COM>
Organization: BT Internet
Subject: VSAM KSDS HELP! Packed Decimal Index problem.
I have created a program that needs to retrieve about 8 records from a
multi-million obs VSAM dataset. Using keyed access with and INFILE
statement is easy with Character fields in the index. but the file I am
trying to read contains price data orderd by 'Fund' [$CHAR5.] and 'Date'
[PD4.] and 'Time' [PD4.]. I have tried many things but nothing seems to
work...!!! the problem lies with the Packed data the dates are formated as
7 digit numbers, CYYMMDD. e.g. 1991231 would be "31st December 1999". The
number is then subtraced from 9999999 so the records are accessed in
descending order, most current price first (ingenious). so the above example
would be. 8008768.
I have the SAS guide to VSAM processing but can't find any examples where
the index is not a Character field. This is the basics of what I am trying
to do.
DATA _NULL_;
SET REGTOT; /* regtot is a summary of file created earlier in the job.
*/
KEYDATE = 9999999 - &RUNDATE;
/* KEYVAL = FUND || KEYDATE */
INFILE F02KSDS VSAM KEY=(FUND KEYDATE) GENKEY ...... return codes etc...
INPUT @56 BIDPRICE PD6.4
@62 OFFPRICE PD6.4
;
..... all the error handling code (from the manual) goes in here...
Depending on what i do, [ i have mucked around with LENGTH staements and
concatenating converting to Chr. data, used fixed index eg. KEYVAL = '33
8008895' and lots more..] i either get lots of VSAM I/O ERRORS (particularly
keylength to long or equal to 0) or the handling code intercepts and logs
not record wiht the specified index.
Please someone help me
Graeme Stow
ps. sorry for the lack of real code but that is at work on our mainframe,
and i didn't think to bring it home, maybe on monday.