karunkallore Beginner
Joined: 11 Dec 2004 Posts: 103 Topics: 39
|
Posted: Wed Mar 23, 2005 9:21 pm Post subject: PLI..One File Two DDNAME..... |
|
|
Dear friends,
I have this Queer Little issue in PL/I. Let me Just give a Background of the scenario before coming to the issue...
Backround
------------
I have this PL/I program PGM1.
Here it is dynamically allocating a VSAM KSDS file named DATA1.KSDS.TEST. Then it is writing records to it using two DDNAMES
viz DDF and DDC.
It is doing it using the below code :-
For DDF :-
CHAR_DSN = 'DATA1.KSDS.TEST' ;
DYNAM_WORK = 0;
DYNAM_DD = 'DD=DDF'
|| SEMI_COLON;
DYNAM_DSN = 'DSN='
|| CHAR_DSN
|| SEMI_COLON;
DYNAM_DISP = PARM_DISP
|| SEMI_COLON;
CALL DYNAMX(DYNAM_WORK,'ALLOC ',DYNAM_DD,DYNAM_DSN,DYNAM_DISP);
For DDC:-
CHAR_DSN = 'DATA1.KSDS.TEST' ;
DYNAM_WORK = 0;
DYNAM_DD = 'DD=DDC'
|| SEMI_COLON;
DYNAM_DSN = 'DSN='
|| CHAR_DSN
|| SEMI_COLON;
DYNAM_DISP = PARM_DISP
|| SEMI_COLON;
CALL DYNAMX(DYNAM_WORK,'ALLOC ',DYNAM_DD,DYNAM_DSN,DYNAM_DISP);
Here the varibales are :-
DCL PARM_DISP CHAR (23) INIT
('CYL RLSE PRIMARY=1 OLD');
Here if my Understanding is correct then the file is already present and the Module DYNAMX just associates it with the
DDNAME.
Now futher down the program processinf i am writing records to this file DATA1.KSDS.TEST using two DDNAMES as mentioned
above , i.e DDF and DDC.
In PGM1 the DDF and DDC are declared as below :-
DCL DDF FILE OUTPUT RECORD KEYED ENV(VSAM);
DCL DDC FILE UPDATE RECORD KEYED ENV(VSAM);
PGM1 is calling one subroutine Sub-A ( PLI again )
to write records to the file 'DATA1.KSDS.TEST' using DDF.
In Sub-A DDF is declared as below :-
DCL DDF FILE OUTPUT RECORD KEYED ENV(VSAM);
The file is opened and closed in Sub-A. In Sub-A the writing of records is done in as shown below :-
WRITE FILE(DDC) FROM(OUTRECA)
KEYFROM(OUTKEY);
Then further down processing in PGM1 it is calling one subroutine Sub-B ( PLI again ) to write records to the file
'DATA1.KSDS.TEST' using DDC.
In Sub-B DDC is declared as below :-
DCL DDC FILE RECORD UPDATE KEYED ENV(VSAM);
The file is again opened and closed in Sub-B.In Sub-B the writing of records is done in as shown below :-
WRITE FILE(DDC) FROM(OUTRECB)
KEYFROM(OUTKEY);
This file 'DATA1.KSDS.TEST' is not written any where in the driver PGM1. Also It is neither closed or opened in the driver.
The opening, closing,writing of the file is happening only in the subroutines Sub-A and Sub-B.
ISSUE
---------
Now coming to the Issue.
Here i need to have only One DDNAME DDF for writing to the file
'DATA1.KSDS.TEST'.
Now definitetly DDF cannot have two types of declarations viz OUTPUT and UPDATE neither in the driver nor in the
subroutines. It it has then it will give and ONCODE 53.
Also i am facing issues if i make the decalaration UPDATE or OUTPUT throughout driver and subroutine for DDF. If i am doing
that I am getting an ONCODE 82.
Please guide me in this issue so that I can have One DDANAME DDF for writing the records into the VSAM KSDS file
'DATA1.KSDS.TEST' in Sub-A and Sub-B and remove DDNAME DDC.
In a Nut shell all the functionality remaining the same in Driver ( PGM1 ) and Subroutines ( Sub-A and Sub-B ) , just One
DDNAME DDF is only required for writing da the VSAM KSDS file 'DATA1.KSDS.TEST'. The writing to the file 'DATA1.KSDS.TEST'
using DDNAME DDC should go off.
All helps are really appreciated.
Thanks a Lot for your patience in reading till here.
Regards,
Karun. |
|