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
 

 

Batch reset browse

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
tvinodkumar7

New User


Joined: 06 Jan 2015
Posts: 18
Location: Hyderabad, INDIA

PostPosted: Wed Jun 24, 2015 4:33 pm    Post subject: Reply to: sample program for dynamic access of VSAM file
Reply with quote

Can we do reset browse in COBOL batch program just like RESETBR in CICS ?

My Scenario :

As per my requirement I have to do multiple dynamic reads on a single file.
In that process if I receive any END OF FILE, I am closing and reopening the file for not to get abend.

If we get same in CICS, we use RESETBR.

Can anyone suggest how to do in a batch program ?

TIA.[/u]
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jun 24, 2015 5:23 pm    Post subject: Reply to: sample program for dynamic access of VSAM file
Reply with quote

You're going to have to show some of your code. What abend? Presumably you are aware of START ... KEY IS ... or READ ... KEY IS ...? Opening an closing a file more than once in a program is never necessary.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Wed Jun 24, 2015 5:54 pm    Post subject:
Reply with quote

Replying to a topic more than 9 years old, and starting a new, totally unrelated thread in the topic, is something you should not be doing. I've split the new thread from the old topic.
Back to top
View user's profile Send private message
tvinodkumar7

New User


Joined: 06 Jan 2015
Posts: 18
Location: Hyderabad, INDIA

PostPosted: Thu Jun 25, 2015 10:31 am    Post subject: Reply to: Batch reset browse
Reply with quote

@Bill Woodger
Thank you for your reply.

I am getting file status 46 (expected) as I am trying to read the same file after getting file status - 10.

Can we have any alternative to Closing and opening a file multiple times in the cobol batch program ?

@Robert Sample
I believe this will give added knowledge. Anyways thank you for creating a new thread.

TIA
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7904
Location: Bellevue, IA

PostPosted: Thu Jun 25, 2015 5:41 pm    Post subject:
Reply with quote

After you get the file status 10, before you attempt another READ NEXT, you MUST do a START to reset the key location. Your 46 file status indicates you are not doing this.

There is NEVER a need to close and re-open a file in a COBOL program. Sometimes people code their programs to do this, but it is due to lack of understanding of logic and COBOL that causes this.

You need to add the START logic to your program and your file status 46 will go away.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Jun 25, 2015 6:32 pm    Post subject: Reply to: Batch reset browse
Reply with quote

In your SELECT statement, ACCESS must be DYNAMIC (not SEQUENTIAL nor RANDOM), because you're jumping all over the file (simulating a CICS RESETBR).

HTH....
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 331
Location: USA

PostPosted: Thu Jun 25, 2015 7:24 pm    Post subject: Reply to: Batch reset browse
Reply with quote

I believe there can be another method instead of opening and closing file multiple times in a program. If your file is small, then you can populate it in an array and use SEARCH to get the records you want.

If the file is being used in other programs in the similar manner then you can write a subprogram that reads the file, populate the array (when called for the first time from main module) and search (when called subsequent times from the main module).

.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Jun 25, 2015 10:52 pm    Post subject: Re: Reply to: Batch reset browse
Reply with quote

RahulG31 wrote:
If the file is being used in other programs in the similar manner then you can write a subprogram that reads the file, populate the array (when called for the first time from main module) and search (when called subsequent times from the main module).


Actually, a sub-program would not be necessary. Just define an ODO table/array in LINKAGE, with a very high-maximum and have a previous step pass the number of records in the flat-file. If this is a VSAM file, then yes, a sub-program would be necessary which issues a SHOWCB macro.

After obtaining the number of records, multiply this number by the LRECL and add 4 (ODO Fullword). Then, call LE Callable Service routine "CEEGTST" and obtain the amount of storage you need and set your Fullword appropriately. After that, read the file into the table/array and that will be that.

By using the ODO with a high-maximum in LINKAGE, you're only allocating enough storage for the size of the file, which could vary from one run to another.
If the table/array was defined to WS with a very high-maximum, the amount of storage allocated is always the maximum size of the ODO, so it would be a waste of resources.

IMHO....
Back to top
View user's profile Send private message
tvinodkumar7

New User


Joined: 06 Jan 2015
Posts: 18
Location: Hyderabad, INDIA

PostPosted: Tue Jun 30, 2015 11:50 am    Post subject: Reply to: Batch reset browse
Reply with quote

@Robert Sample
Thank you for your solution. It is working great.

Thanks everyone for your responses....
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 How does a called pgm know if its cal... Graeme Westerman COBOL Programming 4 Tue Nov 29, 2016 9:25 pm
This topic is locked: you cannot edit posts or make replies. MIPS reduction for Batch job Virendra Shambharkar All Other Mainframe Topics 8 Mon Nov 07, 2016 4:02 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts How to show message using batch jobs madprasy TSO/ISPF 7 Fri Sep 09, 2016 6:55 pm
No new posts Delete record or Reset RC code using ... mpawan Compuware & Other Tools 4 Tue Jul 26, 2016 3:52 pm


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