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

Reading Vsam file in Batch program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Arun bv

New User


Joined: 29 Dec 2010
Posts: 41
Location: Mumbai

PostPosted: Sat Jun 04, 2011 11:19 am
Reply with quote

when i read a vsam file using partial key in batch program it is showing record not found,but records were actually present in that Vsam file.

it has composite key having six fields and i intialized whole key first ,then populated first field with proper value,for the second field i moved low-values,populated third value,,i didn populate rest as im going to read the file with partial key..

but file status is 23...that is record not found


could anyone guess out on this...
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Sat Jun 04, 2011 11:33 am
Reply with quote

review a bit Your understanding of partial key
it must be a proper left substring of the full key
so if the full key is ABCDE You can start <browsing> using ...
A, AB, ABC, ABCD

using the three char case and _ as a low value You are trying to start browsing with A_C
and since that is not a proper left substring a NRF is what You get!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jun 04, 2011 11:47 am
Reply with quote

When you say "read", do you mean START and READ NEXT? If you do, you will still get not found if the key for the START is higher than the last record on the file.
Back to top
View user's profile Send private message
Arun bv

New User


Joined: 29 Dec 2010
Posts: 41
Location: Mumbai

PostPosted: Sat Jun 04, 2011 11:48 am
Reply with quote

thanks enrico....


here the requirement is ,i wont know B,E,F in ABCDEF key....


so i have moved low-values to the whole key first...then i populated the fields which i have(i.e., populated A_CD__ in ABCDEF key) ....then read,,,,


so how to handle this case...
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jun 04, 2011 11:51 am
Reply with quote

START with A______. READ NEXT in a loop. Bytes 3-4 higher than part-of-key-you-know, stop, equal process and read next, lower, read next.
Back to top
View user's profile Send private message
Arun bv

New User


Joined: 29 Dec 2010
Posts: 41
Location: Mumbai

PostPosted: Sat Jun 04, 2011 11:53 am
Reply with quote

sry i forgot to mention

START GRP-V KEY >= GR-KEY

READ GRP-V


then read with partial key(in GR-KEY) .....
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Sat Jun 04, 2011 11:57 am
Reply with quote

Or stop for a few times and ask yourself : create - you or someone from design - alternate indexes if application requires that approach.

Data must be correctly placed to serve processes.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10886
Location: italy

PostPosted: Sat Jun 04, 2011 12:00 pm
Reply with quote

Quote:
so i have moved low-values to the whole key first...then i populated the fields which i have(i.e., populated A_CD__ in ABCDEF key) ....then read,,,,

retelling what You have done, will not fix a broken approach!
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jun 04, 2011 12:03 pm
Reply with quote

Arun bv wrote:
sry i forgot to mention

START GRP-V KEY >= GR-KEY

READ GRP-V


then read with partial key(in GR-KEY) .....


Fine, but READ (a keyed read, unrelated to the START,won't work) or READ NEXT, record which is first equal to or greater than the key of the START (having checked file-status of START, of course)?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Sat Jun 04, 2011 12:12 pm
Reply with quote

It is also pointless, re-read enrico's post, to set anything other than the left-most part of the key. The "left-most" can be anything, up to and including the entire key, but setting a bit of left-most and then something further off to the right is pointless and will confuse anyone maintaining your program in the future.

For your processing, set the left-most (or high-order) byte (from your example) and leave the rest as low-values. As already stated, do your lower-but-non-contiguous-key processing in a read-next loop. Don't forget file-status on all IO. Including START and READ NEXT. All, means ALL.

If your data is such that an alternate key would help (you or your analyst, immediate senior, whatever have to decide, but it must be a rational decision based on the data, not on trying to make the code in one program easier) then try to process file such that the input is in the same order as the alternate key.
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 MacKinney Batch to CICS upgrade causi... CICS 7
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts Excuting store procedure via JCL batch JCL & VSAM 1
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
Search our Forums:

Back to Top