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

Open and close a file in the calling program


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
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
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
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
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: 8797
Location: Welsh Wales

PostPosted: Wed May 28, 2008 11:28 am
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: 275
Location: Bang,iflex

PostPosted: Wed May 28, 2008 11:31 am
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: 275
Location: Bang,iflex

PostPosted: Wed May 28, 2008 11:44 am
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
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: 1702
Location: Australia

PostPosted: Wed May 28, 2008 12:03 pm
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
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: 275
Location: Bang,iflex

PostPosted: Thu May 29, 2008 8:53 am
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

Moderator Emeritus


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

PostPosted: Thu May 29, 2008 9:29 am
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: 275
Location: Bang,iflex

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

Hi Dick,

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

Moderator Emeritus


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

PostPosted: Thu May 29, 2008 7:09 pm
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
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

Superior Member


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

PostPosted: Tue Jul 29, 2008 5:03 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top