MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Dynamic File Allocation in COBOL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Mon Jul 26, 2004 9:43 am    Post subject: Dynamic File Allocation in COBOL Reply with quote

I am using BPXWDYN to allocate a file in cobol dynamically. My question is - can the program be written generic to accept files with any LRECL as input ?

That is If I allocate a dataset (for use as input) using ALLOC command as shown below
Code:

'ALLOC DD(INFILE) DSN(''MY.PS.NAME'') SHR'.


then I should code a corresponding File Section entry like this right ?
Code:

FILE SECTION.                               
                                             
FD IN-PDS                                   
   RECORDING MODE IS F                       
   LABEL RECORDS ARE STANDARD               
   BLOCK CONTAINS 0 RECORDS                 
   DATA RECORD IS IN-REC.                   
                                             
01 IN-REC                      PIC X(80).   


I don't want to fix the file size as 80 Bytes. I want to accept files with any LRECL. Can this be accomplished in COBOL ?

Thanks a lot,
Phantom
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12359
Topics: 75
Location: San Jose

PostPosted: Mon Jul 26, 2004 10:01 am    Post subject: Reply with quote

Phantom,

COBOL is not yet there to handle dynamich LRECL Files. However there are other ways to achieve this functionality. If you are willing to change the file to variable block then you can read any LRECL datasets.

Code:

FD  IN-PDS                             
    RECORD IS VARYING FROM 1 TO 32760     
    DEPENDING ON ACTUAL-LENGTH.                 
01  IN-REC.                                   
    05  FILLER                  OCCURS 1 TO 32760
                       DEPENDING ON ACTUAL-LENGTH.
        10  FILLER              PIC X.



What exactly are you trying to do ?

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Jul 27, 2004 8:13 am    Post subject: Reply with quote

Thanks a lot kolusu,

Code:

What exactly are you trying to do ?


Nothing much. I was just trying to explore the features of BPXWDYN (Thanks for the documentation that you provided). If I can dynamically allocate different files using BPXWDYN, I thought it should also support dynamic LRECLs. Just out of curiosity.!!!

What I was thinking was, if I can allocate a DDNAME in procedure-division then there should be some way to override the FILE-SECTION entry too....(dynamically).

Thanks,
Phantom
Back to top
View user's profile Send private message
jimmy_augustine
Beginner


Joined: 23 Jun 2004
Posts: 32
Topics: 13

PostPosted: Fri Aug 27, 2004 8:46 am    Post subject: Reply with quote

Phantom,
This is a wonderful peace of information i was looking for!!. Could you please explanin me how do you do that dynamic file allocation on the fly in a COBOL program?
Thanks
Jimmy
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12359
Topics: 75
Location: San Jose

PostPosted: Fri Aug 27, 2004 9:05 am    Post subject: Reply with quote

Jimmy,

Please search before posting. There are several examples showing dynamic allocation using BPXWDYN.

Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=1905&highlight=bpxwdyn

Hope this helps...

Cheers

kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jmoorthy
Beginner


Joined: 23 Aug 2007
Posts: 5
Topics: 1

PostPosted: Thu Aug 23, 2007 11:35 pm    Post subject: Reply with quote

Hi,
Is any one can help give a code of this module (BPXWDYN )and same for allocation and deallocation of datasets. I dont have facility to call The modulle in mainframe .

Thanks in advance
Back to top
View user's profile Send private message
Jmoorthy
Beginner


Joined: 23 Aug 2007
Posts: 5
Topics: 1

PostPosted: Fri Aug 24, 2007 4:39 am    Post subject: Reply with quote

How to allocate a dynamic tape dataset ?
Please advise in this regard
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12359
Topics: 75
Location: San Jose

PostPosted: Fri Aug 24, 2007 7:09 am    Post subject: Reply with quote

Jmoorthy wrote:
How to allocate a dynamic tape dataset ?
Please advise in this regard


Jmoorthy,

You canNOT allocate a dynamic tape dataset.

Kolusu
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jmoorthy
Beginner


Joined: 23 Aug 2007
Posts: 5
Topics: 1

PostPosted: Wed Aug 29, 2007 11:58 pm    Post subject: Reply with quote

Thank you ,

Please suggest me how to deallocate a dataset. I have tried with delete or Removing the catolog in that sequence .But my requirment is only deallocate a particular dataset.
Back to top
View user's profile Send private message
Jmoorthy
Beginner


Joined: 23 Aug 2007
Posts: 5
Topics: 1

PostPosted: Thu Aug 30, 2007 12:11 am    Post subject: Reply with quote

The above query is for dynamic deallocation .
Also I can allocate only dynamic Disk DATSET , Please suggest in anyother High level assembler language its possible to dynamic allocate or deallocate all type of datset.Please advise in this regard.
Actually my requirment is I want to allocate or deallocate a dynamic datset with high level assembler .I will this as a routine in calling program .Calling program
should give input that for its allocate or deallocate .If allocate ddname and dsnname and status . If status is new user has to mention UNIT,VOLUME,RECFM,LREC,EXPDTall the inputs,Id its a SHR or OLD no problem.
After getting thes inputs from user This above routine will allocate a dataset.
llly , For deallocation get ddname and dsnname .once received deallcoate a dataset
buT For deallocation how to deallocate ,I am not sure about deallocation
Please advise in this regard , Whether this way is correct.
Back to top
View user's profile Send private message
jim haire
Beginner


Joined: 30 Dec 2002
Posts: 140
Topics: 40

PostPosted: Tue Nov 23, 2021 12:33 pm    Post subject: Reply with quote

Kolusu,
I saw you posted back in 2007 that you cannot dynamically allocate a tape dataset. I am wondering if the capability is available for allocating a virtual tape dataset?

I have tried BPXWDYN. I also tried writing ALLOC lines to a dataset that IDCAMS could process. I don't know if I have these formatted incorrectly or it just isn't possible.

My scenario is that I am reading in a dataset which contains the names of a input file and an output file. I read in a record and try to allocate the output dataset like the input dataset, except I want to allocate the output dataset as a VTS, because the file is very large.

I then write a REPRO line to copy the input dataset to the output dataset.
It appears that the only part that does not work is the allocation of the tape dataset. I have used the UNIT() and the RETPD() parameters. I don't want to use the VOLUME() parameter as I don't know the volume number to use. Is there a different parameter I could use?

Thanks for your help!
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12359
Topics: 75
Location: San Jose

PostPosted: Tue Nov 23, 2021 3:40 pm    Post subject: Reply with quote

jim haire wrote:
Kolusu,
I saw you posted back in 2007 that you cannot dynamically allocate a tape dataset. I am wondering if the capability is available for allocating a virtual tape dataset?

I have tried BPXWDYN. I also tried writing ALLOC lines to a dataset that IDCAMS could process. I don't know if I have these formatted incorrectly or it just isn't possible.


Jim,

You can allocate a tape dataset now with BPXWDYN. You need to provide the parm MOUNT. Check this Link for the documentation of BPXWDYN

jim haire wrote:

My scenario is that I am reading in a dataset which contains the names of a input file and an output file. I read in a record and try to allocate the output dataset like the input dataset, except I want to allocate the output dataset as a VTS, because the file is very large.


You can use DFSORT to read the input file and dynamically generate the JCL which will be submitted via INTRDR to copy where you can provide all the parameters to Output datasets. Let me know if you are interested in doing that.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
haatvedt
Beginner


Joined: 14 Nov 2003
Posts: 66
Topics: 0
Location: St Cloud, Minnesota USA

PostPosted: Fri Dec 31, 2021 1:52 am    Post subject: Reply with quote

Jim / Kolusu,

years ago I used BPXWDYN to dynamically allocate a tape dataset. However I had to request a security change to allow my userid to dynamically mount tapes.

perhaps this has changed, however you may want to check with you system programmers / security folks.
_________________
Chuck Haatvedt

email --> clastnameatcharterdotnet

(replace lastname, at, dot with appropriate
characters)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group