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

Batch reset browse


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

New User


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

PostPosted: Wed Jun 24, 2015 4:33 pm
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

Moderator Emeritus


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

PostPosted: Wed Jun 24, 2015 5:23 pm
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed Jun 24, 2015 5:54 pm
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: 19
Location: Hyderabad, INDIA

PostPosted: Thu Jun 25, 2015 10:31 am
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: 8697
Location: Dubuque, Iowa, USA

PostPosted: Thu Jun 25, 2015 5:41 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jun 25, 2015 6:32 pm
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: 446
Location: USA

PostPosted: Thu Jun 25, 2015 7:24 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jun 25, 2015 10:52 pm
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: 19
Location: Hyderabad, INDIA

PostPosted: Tue Jun 30, 2015 11:50 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts HILITE on Browse mode? TSO/ISPF 2
No new posts How to get a stack trace on a looping... ABENDS & Debugging 5
No new posts Calling Java method from batch COBOL ... COBOL Programming 5
No new posts Help in Automating Batch JCL jobs mon... JCL & VSAM 3
No new posts Batch install term/printer CICS 2
Search our Forums:

Back to Top