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
 

 

Open and close a file in the calling program

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

New User


Joined: 19 May 2008
Posts: 2
Location: bangalore

PostPosted: Wed May 28, 2008 11:08 am    Post subject: Open and close a file in the calling program
Reply with 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?

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
View user's profile Send private message

the_gautam

Active User


Joined: 05 Jun 2005
Posts: 165
Location: Bangalore

PostPosted: Wed May 28, 2008 11:11 am    Post subject:
Reply with quote

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
View user's profile Send private message
shreevamsi

Active User


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

PostPosted: Wed May 28, 2008 11:23 am    Post subject: Reply to: interview question
Reply with quote

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
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Wed May 28, 2008 11:28 am    Post subject:
Reply with quote

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
View user's profile Send private message
vasanthkumarhb

Active User


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

PostPosted: Wed May 28, 2008 11:31 am    Post subject:
Reply with quote

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...... icon_redface.gif

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
View user's profile Send private message
vasanthkumarhb

Active User


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

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

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
View user's profile Send private message
shreevamsi

Active User


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

PostPosted: Wed May 28, 2008 11:54 am    Post subject: Reply to: interview question
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed May 28, 2008 12:03 pm    Post subject:
Reply with quote

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


Gerry
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 May 28, 2008 9:47 pm    Post subject: Re: Reply to: interview question
Reply with quote

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
View user's profile Send private message
vasanthkumarhb

Active User


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

PostPosted: Thu May 29, 2008 8:53 am    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 29, 2008 9:29 am    Post subject:
Reply with quote

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
View user's profile Send private message
vasanthkumarhb

Active User


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

PostPosted: Thu May 29, 2008 10:34 am    Post subject:
Reply with quote

Hi Dick,

Thank you very much.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

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

You're welcome icon_smile.gif

d
Back to top
View user's profile Send private message
jyothimenon1

New User


Joined: 16 Jul 2008
Posts: 9
Location: bangalore

PostPosted: Tue Jul 29, 2008 4:42 pm    Post subject: Reply to: Open and close a file in the calling 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
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

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

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..?... icon_biggrin.gif
Back to top
View user's profile Send private message
jyothimenon1

New User


Joined: 16 Jul 2008
Posts: 9
Location: bangalore

PostPosted: Tue Jul 29, 2008 5:59 pm    Post subject: Reply to: Open and close a file in the calling program
Reply with quote

yes. reading 10 records in calling program then calling a program( called program) trying to read the same file. will it read from 11 th record or from first record
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 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 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 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