View previous topic :: View next topic
|
Author |
Message |
nabarun
New User
Joined: 27 Apr 2005 Posts: 13 Location: india
|
|
|
|
i want to sreach a KSDS file using EXEC CICS READ
the keys are like this:
aa500
ba500
ca501
da500
...................
i hv to search the records ending with 00 in the keyfield.
how can i do this? |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
READ
DATASET (file name)
INTO (data area)
RIDFLD (record key area)
GENERIC
KEYLENGTH (data value)
you can use generic option for partial key but i dont think you can use it for last bytes of the key ..... keylength in the above read specifies how many bytes of the key shud match starting from left ...... i dont knw abt any option to match the last few bytes of the key ...... |
|
Back to top |
|
|
nabarun
New User
Joined: 27 Apr 2005 Posts: 13 Location: india
|
|
|
|
that thing i know but i want to search by using the last two bytes. how i can do so??? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if the file is not toooooo big: SORT and keep only those with '00' in last part of key.
if you must read thru cobol, as the other poster says, you can't define a key for a read as %00, you have to read everything and only process those that fit the pattern (a COBOL compare - IF assend-of-the-key = '00'
a little reading of the manual would have helped you.
by the way, really lousy title for a question. |
|
Back to top |
|
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
the file being a ksds u cannot sort the file based on some chars on the key .... in vsam the entry is made according to ascending values of the key and is already sorted ......
in this case read the file chk for the key and if the key matches ur criteria search the record or else do a read next .... |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
ashmir,
1. you can sort a VSAM KSDS file, just declare it as the input.
2. since you can input a VSAM KSDS file to sort, use an include parm to only keep those with the '00' in the proper location.
3. output of sort will be those records which poster needs. |
|
Back to top |
|
|
|