Page 1 of 1

change dsname during exec cobol mainframe

PostPosted: Fri Mar 25, 2011 1:11 am
by linocbneto
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?

Re: change dsname during exec cobol mainframe

PostPosted: Fri Mar 25, 2011 1:23 am
by Robert Sample
Use BPXWDYN.

Re: change dsname during exec cobol mainframe

PostPosted: Fri Mar 25, 2011 2:33 am
by steve-myers
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.

Re: change dsname during exec cobol mainframe

PostPosted: Fri Mar 25, 2011 3:15 am
by MrSpock
Has using BPXWDYN proven to be a better/easier option than the older methods like using TSO (IKJTSOEV)?

Re: change dsname during exec cobol mainframe

PostPosted: Fri Mar 25, 2011 5:15 am
by BillyBoyo
May be my dumb question of the week, but why can't you use two DDNAMEs?

Re: change dsname during exec cobol mainframe

PostPosted: Sun Mar 27, 2011 10:18 pm
by DFSHDC40
..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]