IBM MAINFRAME HELP FORUMS for COBOL, JCL, CICS, DB2, IMS etc...
Help & Support Forums for IBM Mainframe computers Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7, CA-11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, VSAM, ISPF, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

Open and close a file in the calling program

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC
Goto page 1, 2  Next
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Interview Questions
View previous topic :: View next topic  
Author Message
rakeshvp3



Joined: 19 May 2008
Posts: 2
Location: bangalore

Posted: Wed May 28, 2008 11:08 am    Post subject: Open and close a file in the calling program  

1. Is it possible to open and close a file in the calling program and to read the records of the file in the called program?

2. A JCL
//SYSIN DD DSN=A.B.C, disp= old
//SYSIN DD DSN=P.Q.R, disp=old
Will it concatenate or not?

3.How many files will be created while creating a table?

4.If two temperory datasets of the form DSN=&WORK and DSN=&&WORK in the job stream , will the system intercept it as a same dataset or different ?
Back to top  
the_gautam



Joined: 05 Jun 2005
Posts: 168
Location: Bangalore

Posted: Wed May 28, 2008 11:11 am    Post subject:  

What files are you talking about?
When you create a DB2 table, the table is created under a TABLESPACE.

Quote: DSN=&WORK
The & symbol is used to indicate the symbolic override.
Back to top  
shreevamsi



Joined: 23 Feb 2006
Posts: 320
Location: Hyderabad,India

Posted: Wed May 28, 2008 11:23 am    Post subject: Reply to: interview question  

1. Yes you can open or close a file in a calling program and read or write in a called program

2. Concatination can be done by the following method only.
//SYSIN DD DSN=A.B.C, disp= old
// DD DSN=P.Q.R, disp=old

3. When we create a table, we won;t be explicitly create any files.

4. One is a Symbolic Parm and the other is a Temp dataset. There shouldn't be any problem.[/quote]
Back to top  
expat



Joined: 14 Mar 2007
Posts: 3270
Location: Brussels once more ...

Posted: Wed May 28, 2008 11:28 am    Post subject:  

Quote:
2. A JCL
//SYSIN DD DSN=A.B.C, disp= old
//SYSIN DD DSN=P.Q.R, disp=old
Will it concatenate or not?

3.How many files will be created while creating a table?


2) Not concatenation, probably a JCL error
- should fail on disp= old (space present)

3) What type of table are you creating ?
DB2, ISPF, in storage ???
Back to top  
vasanthkumarhb



Joined: 06 Sep 2007
Posts: 298
Location: Bang,iflex

Posted: Wed May 28, 2008 11:31 am    Post subject:  

Hi,

Quote: 1. Is it possible to open and close a file in the calling program and to read the records of the file in the called program?


Ans: If u want read in calling program and move it LIKAGE SECTION LN-REC (record structure) then u can make use of these variable data in called progam.

But according to your question opening and closing in calling program and reading in called program is not possible.


Quote: 2. A JCL
//SYSIN DD DSN=A.B.C, disp= old
//SYSIN DD DSN=P.Q.R, disp=old
Will it concatenate or not?

Ans: No,it wil not concatenate.

Quote: 3.How many files will be created while creating a table?

Ans: Ambigius Question...... :oops:

Quote: 4.If two temperory datasets of the form DSN=&WORK and DSN=&&WORK in the job stream , will the system intercept it as a same dataset or different ?

Ans: & is an symbolic override parameter as suggest before, also && indicates temporary data set, you can make use of it, i guess nothing to worry.
Back to top  
vasanthkumarhb



Joined: 06 Sep 2007
Posts: 298
Location: Bang,iflex

Posted: Wed May 28, 2008 11:44 am    Post subject: Re: Reply to: interview question  

Hi Vamsi


shreevamsi wrote: 1. Yes you can open or close a file in a calling program and read or write in a called program [/quote]

I felt quite intresting to your above answer, please give an example for the above answer.
Back to top  
shreevamsi



Joined: 23 Feb 2006
Posts: 320
Location: Hyderabad,India

Posted: Wed May 28, 2008 11:54 am    Post subject: Reply to: interview question  

Hi Vasanth,

I use an generic program to open or close a particular file. The file holds the details of the No of records processed in the particular run.

The details are captured in the called program.

~Vamsi
Back to top  
gcicchet



Joined: 28 Jul 2006
Posts: 578

Posted: Wed May 28, 2008 12:03 pm    Post subject:  

Hi,
I know 1 & is not strictly correct but both & and && will give the same temporary dataset name.


Gerry
Back to top  
Douglas Wilder



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

Posted: Wed May 28, 2008 9:47 pm    Post subject: Re: Reply to: interview question  

vasanthkumarhb wrote: 1. Yes you can open or close a file in a calling program and read or write in a called program
shreevamsi wrote: I felt quite intresting to your above answer, please give an example for the above answer.

This can be done with an "External" file.
Put the Select and FD statements in both the calling and the called program. The FD in both should contain the word "External".
Then open and close the file in the calling program as normal, and read or write the file as normal in the called program.
Back to top  
vasanthkumarhb



Joined: 06 Sep 2007
Posts: 298
Location: Bang,iflex

Posted: Thu May 29, 2008 8:53 am    Post subject:  

Hi,


Quote: The FD in both should contain the word "External".

Now i got the solution, i need to know, how FD can be declared as "EXTERNAL"?
Back to top  
dick scherrer



Joined: 23 Nov 2006
Posts: 8059
Location: 221 B Baker St

Posted: Thu May 29, 2008 9:29 am    Post subject:  

Hello,

Start here:http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr10/5.2?

Took about 30 seconds. . . .

d
Back to top  
vasanthkumarhb



Joined: 06 Sep 2007
Posts: 298
Location: Bang,iflex

Posted: Thu May 29, 2008 10:34 am    Post subject:  

Hi Dick,

Thank you very much.
Back to top  
dick scherrer



Joined: 23 Nov 2006
Posts: 8059
Location: 221 B Baker St

Posted: Thu May 29, 2008 7:09 pm    Post subject: Reply to: Open and close a file in the calling program  

You're welcome :)

d
Back to top  
jyothimenon1



Joined: 16 Jul 2008
Posts: 10
Location: bangalore

Posted: Tue Jul 29, 2008 4:42 pm    Post subject: Reply to: Open and close a file in the calling program  

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  
Anuj D.



Joined: 22 Apr 2006
Posts: 1983
Location: Phoenix, AZ

Posted: Tue Jul 29, 2008 5:03 pm    Post subject: Re: Reply to: Open and close a file in the calling program  

jyothimenon1 wrote: ..I gave a read in the called program then will I get the 11th record or the first record? Do you open it in CALLed program as well..?... :D
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Interview Questions Goto page 1, 2  Next
Page 1 of 2
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM
Related Links