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
 

 

which record will be read in called program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
jyothimenon1

New User


Joined: 16 Jul 2008
Posts: 9
Location: bangalore

PostPosted: Wed Jul 30, 2008 12:29 pm    Post subject: which record will be read in called program
Reply with quote

here what will happen?

I have a doubt regarding open a file in one program and use it in its called program

Consider the scenario where I read 10 records from the file using the main program and if I gave a read in the called program then will I get the 11th record or the first record? (Here Im talking about the case that we are not carrying any key info from the main program to the sub program)
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Jul 30, 2008 12:34 pm    Post subject:
Reply with quote

batch or online.

if batch, you need two fd's, which means what you read in the second has nothing to do with the first.

if online, and you are passing keys, and you can only read vsam, you are going to have diddely in the second.
Back to top
View user's profile Send private message
sudhakar84

New User


Joined: 20 Jun 2008
Posts: 21
Location: chennai

PostPosted: Wed Jul 30, 2008 3:26 pm    Post subject: Reply to: which record will be read in called program
Reply with quote

dbzTHEdinosauer , Thanks for the info.
Back to top
View user's profile Send private message
jyothimenon1

New User


Joined: 16 Jul 2008
Posts: 9
Location: bangalore

PostPosted: Wed Jul 30, 2008 4:49 pm    Post subject: Reply to: which record will be read in called program
Reply with quote

hai dbzTHEdinosauer,

Thank you so much for the reply
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jul 30, 2008 5:09 pm    Post subject:
Reply with quote

Is it a COBOL EXTERNAL file? Does the subprogram have a separate file definition and open? The answer will vary depending on the precise environment ....
Back to top
View user's profile Send private message
jyothimenon1

New User


Joined: 16 Jul 2008
Posts: 9
Location: bangalore

PostPosted: Wed Jul 30, 2008 5:59 pm    Post subject: Reply to: which record will be read in called program
Reply with quote

hai Robert

The sub program have seperate FD then what will happen?

please help me if there is no seperate FD for sub program, is it possible ?


In the case of external file declared in calling program , is there need to declare FD again in called program?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Jul 30, 2008 6:40 pm    Post subject:
Reply with quote

I know about EXTERNAL files but haven't used one (so far). The Programming Guide has a write up with examples:http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/IGY3PG20/4.2.6.1?DT=20040220035836 of how to do the main and subprogram(s).
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Wed Jul 30, 2008 7:47 pm    Post subject:
Reply with quote

If the file is declared external, both programs will have an FD with "external" in it. In this case if one program reads 10 records, then the next record read by either program will be the 11th record.
If the file is not external, both programs will have an FD, but each program must open the file and they are independent. If one program reads 10 records and then the other program reads a record, it will get record 1.
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 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 IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm


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