View previous topic :: View next topic
|
Author |
Message |
aman jain
New User
Joined: 13 Jan 2008 Posts: 4 Location: Noida
|
|
|
|
Hi, I have a VSAM file having key length of 16 bytes of which last 6 bytes are not requried. How can I use its 10 bytes as keys in program to read or fetch its records from the file to use in the program main procedure.
READ FILE1 KEY WS-FILE1-KEY STATUS
can WS-FILE1-KEY this be of 10 length so that it can read the records in the file matching for only first 10 bytes. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Please post your question in the correct forum. |
|
Back to top |
|
|
aman jain
New User
Joined: 13 Jan 2008 Posts: 4 Location: Noida
|
|
|
|
I mean if a VSAM file is defined of keylength 16 initially then is there any method to use only it's first 10 bytes to find and read its records in Eazytrieve coding.
Code: |
WS-PSINV-KEY W 16 A
WS-BRANCH-NO-3BYTES WS-PSINV-KEY 3 P 0
WS-BRANCH-SUFFIX WS-PSINV-KEY +3 1 A
WS-FOLIO-SERIES-IDENTIFIER WS-PSINV-KEY +4 1 A
WS-FOLIO-YEAR WS-PSINV-KEY +5 2 P 0
WS-FOLIO-MONTH WS-PSINV-KEY +7 2 P 0
WS-FOLIO-NUMBER WS-PSINV-KEY +9 3 P 0
WS-FILLER WS-PSINV-KEY +12 4 A |
IN CODE :
READ FILE1 KEY WS-FILE1-KEY STATUS
Can WS-FILE1-KEY this be of 12 bytes skipping the last 4 bytes spaces. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
If you were using CICS, there's a KEYLENGTH () GENERIC capability.
In batch, you can use START KEY GE <var> where <var> is your 10 bytes of the key. The COBOL Language Reference manual says
Quote: |
The file position indicator points to the first record in the file whose key field satisfies the comparison. If the operands in the comparison are of unequal lengths, the comparison proceeds as if the longer field were truncated on the right to the length of the shorter field. All other numeric and alphanumeric comparison rules apply, except that the PROGRAM COLLATING SEQUENCE clause, if specified, has no effect. |
After the START, and assuming it is successful, you can use READ NEXT to get the record. |
|
Back to top |
|
|
aman jain
New User
Joined: 13 Jan 2008 Posts: 4 Location: Noida
|
|
|
|
Thanks for the prompt response!
Actually I am coding in Eazytrieve and not using CICS.
START KEY GE <var> is being used in COBOL so same can be used in
eazytrive as well.
Please reply!! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
I don't use Easytrieve so I have no idea. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
You may need to use POINT:
Code: |
{= }
{EQ} { }
POINT file-name {GE} {field-name} [STATUS]
{GQ} {literal }
{>=} |
since it appears that READ doesn't allow generic keys:
Code: |
{ }
READ file-name KEY {field-name} [STATUS]
{'literal' } |
|
|
Back to top |
|
|
aman jain
New User
Joined: 13 Jan 2008 Posts: 4 Location: Noida
|
|
|
|
Thank You all!! |
|
Back to top |
|
|
|