Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reading Vsam file in Batch program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Reading Vsam file in Batch program
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sat Jun 04, 2011 11:33 am    Post subject: Reply to: [b]Reading Vsam file in Batch program[/b]
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Jun 04, 2011 11:47 am    Post subject: Reply to: Reading Vsam file in Batch program
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    Post subject: Reading Vsam file in Batch program
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Jun 04, 2011 11:51 am    Post subject:
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    Post subject: reply to all
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: 456
Location: Belgium

PostPosted: Sat Jun 04, 2011 11:57 am    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Sat Jun 04, 2011 12:00 pm    Post subject: Reply to: Reading Vsam file in Batch program
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Jun 04, 2011 12:03 pm    Post subject: Re: reply to all
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Sat Jun 04, 2011 12:12 pm    Post subject: Reply to: Reading Vsam file in Batch program
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us