View previous topic :: View next topic
|
Author |
Message |
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Reddy,
Please read the post from the beginning. The initial post post says
Quote: |
--> i can't concatenate two file |
|
|
Back to top |
|
|
kgumraj
Active User
Joined: 01 May 2006 Posts: 151 Location: Hyderabad
|
|
|
|
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 |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
If this is for me, then my name is Anuj not Anju
However,coming to the topic of thread..
OP says
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 |
|
|
Earl
Active User
Joined: 17 Jun 2007 Posts: 148 Location: oklahoma
|
|
|
|
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 |
|
|
|