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

Is there any way to use TWO files by a single SELECT


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Jun 21, 2007 6:13 pm
Reply with quote

Hello Reddy,

Please read the post from the beginning. The initial post post says
Quote:
--> i can't concatenate two file
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Thu Jun 21, 2007 7:04 pm
Reply with quote

Hi,

I can imagine only this: Using same DD name for the input files.
When I ran it only took the first input file.
But I didnt get the buisnees in doing so icon_neutral.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Jun 30, 2007 9:38 pm
Reply with quote

Hi Anju,

There's a relatively new feature in COBOL (Eviroment Variables - I think) that allows the coder to change the FD stmt to define a different dataset than the one being currently used. It calls a subroutine "putenv", among other things. It's a fairly involved process.

Another approach is BPXWDYN, an interface to SVC 99.

I haven't used either of these so this is about all I know on the subject.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


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

PostPosted: Mon Jul 02, 2007 7:44 pm
Reply with quote

mmwife wrote:
Hi Anju,

Hi,

If this is for me, then my name is Anuj not Anju icon_neutral.gif

However,coming to the topic of thread..
OP says
Quote:
i have two file

so
Quote:
that allows the coder to change the FD
will not suffice the requirement of OP. As stated by you, subroutine 'putenv' will allow to change the FD of the same file while OP says
Quote:
both file have the same attribute as well as the same FD entires
, so he does not want to open the same file with different layout instead he wants to open a different file with the same layout. In a nutshell, there are two input files, with different data, but with same FD entries and he wants to refer both files with a single SELECT.
Back to top
View user's profile Send private message
Earl

Active User


Joined: 17 Jun 2007
Posts: 148
Location: oklahoma

PostPosted: Tue Jul 03, 2007 3:59 am
Reply with quote

I think you can only have max of 16 fd's per cobol program. was involved with project years ago that required using same fd in cobol
program. I used a dynamic allocation subroutine to change
the dataset name on the fly and then open/close the file as logically needed.

FD SAME-FD assign SAMEFD
..
..
..
PROCEDURE DIVISION.
MOVE 'MYFILE.FILEONE' TO WS-FILE-NAME.
CALL 'DYDSN' USING WS-FILE-NAME, SAME-FD, 'SAMEFD'.
OPEN INPUT SAME-FD.
READ SAME-FD INTO WS-SAVE-FILEONE-RECORD.
CLOSE SAME-FD.

MOVE 'MYFILE.FILETWO' TO WS-FILE=NAME.
CALL 'DYDSN' USING WS-FILE-NAME, SAME-FILE.
OPEN INPUT SAME-FD
READ SAME-FD INTO WS-SAVE-FILETWO-RECORD.
PERFORM PROCESS-FILE-TWO.
....
...
....
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top