change dsname during exec cobol mainframe



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

change dsname during exec cobol mainframe

Postby linocbneto » Fri Mar 25, 2011 1:11 am

I have a problem, but I know it can do, but i dónt know the way.... I need to change the dsname for one ddname in a program COBOL BATCH. It means, I wil open a file ddname1 as dsname xxxx, put some records, close then. after that i need to o´pen a file ddname1 , with dsname readed from one DB2. Could some one help me?
linocbneto
 
Posts: 1
Joined: Fri Mar 25, 2011 12:22 am
Has thanked: 0 time
Been thanked: 0 time

Re: change dsname during exec cobol mainframe

 

Re: change dsname during exec cobol mainframe

Postby Robert Sample » Fri Mar 25, 2011 1:23 am

Use BPXWDYN.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: change dsname during exec cobol mainframe

Postby steve-myers » Fri Mar 25, 2011 2:33 am

There is a method that Assembler programmers can use to alter a dataset name, but the new dataset must exist on the same volume as the original dataset, and it must actually exist, which is not well advised for the general case. For a more general case something like a BPXWYN is the better solution, and the BPXWDYN solution is available to Cobol programmers.
steve-myers
Global moderator
 
Posts: 1886
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

Re: change dsname during exec cobol mainframe

Postby MrSpock » Fri Mar 25, 2011 3:15 am

Has using BPXWDYN proven to be a better/easier option than the older methods like using TSO (IKJTSOEV)?
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: change dsname during exec cobol mainframe

Postby BillyBoyo » Fri Mar 25, 2011 5:15 am

May be my dumb question of the week, but why can't you use two DDNAMEs?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: change dsname during exec cobol mainframe

Postby DFSHDC40 » Sun Mar 27, 2011 10:18 pm

..or even dumber - If unknown number of files need writing, write all records to a single file with an indicator byte appended at the start - then post process the file to split it ... saves all that alloc/dealloc overhead [OK maybe not as dear as it once was]
If the code hasn't been changed, why is the LKED date today?
User avatar
DFSHDC40
 
Posts: 41
Joined: Sat Oct 16, 2010 4:16 pm
Location: IMS.SDFSRESL
Has thanked: 0 time
Been thanked: 0 time


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post