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
 

 

Is there any way to use TWO files by a single SELECT
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
devidas-patil

New User


Joined: 08 Jan 2007
Posts: 54
Location: pune

PostPosted: Wed May 30, 2007 10:03 am    Post subject: Is there any way to use TWO files by a single SELECT
Reply with quote

Hi all

i have two file and i want to use both the file in the cobol program and both file have the same attribute as well as the same FD entires but allowed me to use only one SELECT INFILE ASSIGN TO DDNAME
i cant
---> use two select statement in my program and
--> i cant merge two file,
--> i can't concatenate two file

what to do in this situation?
please let me know.
Back to top
View user's profile Send private message

murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed May 30, 2007 10:26 am    Post subject:
Reply with quote

Patil,

Quote:
--> i cant merge two file,
--> i can't concatenate two file


Why cant? Is there any business reason for this.
Back to top
View user's profile Send private message
devidas-patil

New User


Joined: 08 Jan 2007
Posts: 54
Location: pune

PostPosted: Wed May 30, 2007 10:44 am    Post subject:
Reply with quote

hi murali
this is question of my interviews so oi told him this two option but he was expecting something different than this
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Wed May 30, 2007 10:44 am    Post subject:
Reply with quote

Quote:
--> cant use two select statement in my program and
--> i cant merge two file,
--> i can't concatenate two file


Can you atleast execute the program twice with 2 diff files?
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Wed May 30, 2007 11:38 am    Post subject: Re: Is there any way to use TWO files by a single SELECT
Reply with quote

devidas-patil wrote:
Hi all
i have two file ...


I think the interviewer was talking about one input & one output.

Quote:


i cant
---> use two select statement in my program and

Under the above assumption, one can direct the output to SYSOUT dataset & one'll need only one SELECT statement in COBOL program.

Quote:

--> i cant merge two file,
--> i can't concatenate two file
what to do in this situation?


If Both the files are inputs.. then don't know.

Did you ask about the files usage !? If yes please let me know. Hopefully we can come up with some good idea.
Back to top
View user's profile Send private message
devidas-patil

New User


Joined: 08 Jan 2007
Posts: 54
Location: pune

PostPosted: Wed May 30, 2007 2:20 pm    Post subject:
Reply with quote

Hi anuj
i not asked him about the file usage. i am very sure he was asking me both are the input file.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Thu Jun 07, 2007 8:03 pm    Post subject:
Reply with quote

devidas-patil wrote:
Hi anuj
i not asked him about the file usage. i am very sure he was asking me both are the input file.


Hi,

Every file used in COBOL program has to have a SELECT clause, so if both are inputs, then in this situation answer for the question is - not possible.
Back to top
View user's profile Send private message
Devzee

Active Member


Joined: 20 Jan 2007
Posts: 684
Location: Hollywood

PostPosted: Thu Jun 07, 2007 8:15 pm    Post subject:
Reply with quote

Quote:
Every file used in COBOL program has to have a SELECT clause

This is not true and cannot be generalized.

There is no need for SELECT statement in below COBOL code
- From COBOL you can open/close/read using assembler routintes without COBOL SELECT clause
- In IMS COBOL you can read files without COBOL SELECT clause
-In CICS COBOL program there is no need for COBOL SELECT clause
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 Jun 07, 2007 9:08 pm    Post subject:
Reply with quote

Hello,

You might run a step that copies/merges the 2 files into one before executing your program with these strange rules. . . icon_smile.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Fri Jun 08, 2007 7:40 pm    Post subject:
Reply with quote

Hi,

I hope interviewer asked about simple COBOL-batch program, by simple I mean a program which is not using any database. From the window of original question I think I didn't direct the OP in wrong direction.

However, if you can provide some examples or can direct to some link, that would be great to understand your statements rather better.

dick scherrer wrote:
Hello,

You might run a step that copies/merges the 2 files into one before executing your program with these strange rules. . . icon_smile.gif


Dick,
I didn't get your intention here..!?
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: Fri Jun 08, 2007 8:59 pm    Post subject:
Reply with quote

Hi Anuj,

If the files were combined prior to the COBOL program, the rather non-business "rules" of the question (can't use 2 . . .etc in the COBOL program) might be met.

I just took that work out of the COBOL code to satisfy the "rules" - probably not the best way to approach this, but keeps the 3 "can't"s out of COBOL icon_confused.gif

There is always the chance that what the interviewer meant to ask and what was understood to be the requirement was not the same. . . Happens quite often when you combine an interviewer with limited technical knowldege with an interviewee with limited experience and especially if they are communicating in a language that is not the "main" language of either one.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


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

PostPosted: Mon Jun 11, 2007 9:28 pm    Post subject:
Reply with quote

Still bounced..!
Let's leave it. icon_neutral.gif
Back to top
View user's profile Send private message
utkarshtewari

New User


Joined: 26 Mar 2007
Posts: 9
Location: UK

PostPosted: Fri Jun 15, 2007 2:13 pm    Post subject: Re: Is there any way to use TWO files by a single SELECT
Reply with quote

Hi Anuj,
Guess what dick is suggesting is that in RUN JCL we need to put a step to merge/sort the two files into one, using Utilities...thus creating a single file to be dealt with in the program...

and in the next JCL step you can execute the program.
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: Sat Jun 16, 2007 5:02 am    Post subject:
Reply with quote

Yup, not a way i'd do it if i had the need to process those files, but might get around the non-business requirement mentioned above.

I am fairly sure there is no business reason for the restrictons. . . icon_confused.gif
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 Jun 19, 2007 6:35 pm    Post subject:
Reply with quote

Thanks Utkarsh. icon_smile.gif

dick scherrer wrote:
I am fairly sure there is no business reason for the restrictons. . . icon_confused.gif


Yeah, I do agree.
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Wed Jun 20, 2007 11:13 am    Post subject: Re: Is there any way to use TWO files by a single SELECT
Reply with quote

When two different files are used in a program two sets of output files or processing(database updates/deletes) is to be expected.

I would suggest to create a proc which would run the program in step1 and overriding the file in step2 which would run the same proc in a jcl to get the results.

Regards,
Syam
Back to top
View user's profile Send private message
Johnson_Jiang

New User


Joined: 05 Apr 2007
Posts: 11
Location: China,ShenZhen

PostPosted: Wed Jun 20, 2007 12:03 pm    Post subject: Implement it in JCL.
Reply with quote

Hi, Patil,

I think the question is about the run jcl. In your COBOL program, you can use one SELECT statement to handle several input file (same layout, same length), just implement it in JCL like follows:

//INPUTFIL DD DSN=FILE1.XXX,DISP=SHR
// DD DSN=FILE2.XXX,DISP=SHR
// DD DSN=FILE3.XXX,DISP=SHR
:
:
:
So in cobol program, you can use:

SELECT Inputfil-file ASSIGN TO INPUTFIL ....

It works!
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1439
Location: Bangalore,India

PostPosted: Wed Jun 20, 2007 12:09 pm    Post subject:
Reply with quote

Johnson,

Quote:
//INPUTFIL DD DSN=FILE1.TTT,DISP=SHR
// DD DSN=FILE2.TTT,DISP=SHR
// DD DSN=FILE3.TTT,DISP=SHR


Please go through the original post, which says - cant concatenate two files.
Back to top
View user's profile Send private message
devidas-patil

New User


Joined: 08 Jan 2007
Posts: 54
Location: pune

PostPosted: Thu Jun 21, 2007 1:25 pm    Post subject:
Reply with quote

Thanks all!!!!!!!!!!!!!
Back to top
View user's profile Send private message
Naresh Kumar Reddy P

New User


Joined: 24 May 2007
Posts: 8
Location: Bangalore

PostPosted: Thu Jun 21, 2007 4:15 pm    Post subject:
Reply with quote

Probably, the interviewer was expecting DD concatination in your JCL. I believe it is the only way to accept two input files with one select statement in your program (for pure cobol program).

Thanks
Reddy
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Two Selects in a single select query Rohit Umarjikar DB2 1 Fri Nov 04, 2016 8:46 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts Single COPY CICS TS datasets and when... Kyle Carroll CICS 2 Tue Oct 11, 2016 9:47 pm


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