| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Phantom Data Mgmt Moderator
 
  
 
 Joined: 07 Jan 2003
 Posts: 1056
 Topics: 91
 Location: The Blue Planet
 
 | 
			
				|  Posted: Mon Jul 26, 2004 9:43 am    Post subject: Dynamic File Allocation in COBOL |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Mon Jul 26, 2004 10:01 am    Post subject: |   |  
				| 
 |  
				| 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
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Phantom Data Mgmt Moderator
 
  
 
 Joined: 07 Jan 2003
 Posts: 1056
 Topics: 91
 Location: The Blue Planet
 
 | 
			
				|  Posted: Tue Jul 27, 2004 8:13 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| jimmy_augustine Beginner
 
 
 Joined: 23 Jun 2004
 Posts: 32
 Topics: 13
 
 
 | 
			
				|  Posted: Fri Aug 27, 2004 8:46 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Jmoorthy Beginner
 
 
 Joined: 23 Aug 2007
 Posts: 5
 Topics: 1
 
 
 | 
			
				|  Posted: Thu Aug 23, 2007 11:35 pm    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| Jmoorthy Beginner
 
 
 Joined: 23 Aug 2007
 Posts: 5
 Topics: 1
 
 
 | 
			
				|  Posted: Fri Aug 24, 2007 4:39 am    Post subject: |   |  
				| 
 |  
				| How to allocate a dynamic tape dataset ? Please advise in this regard
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Fri Aug 24, 2007 7:09 am    Post subject: |   |  
				| 
 |  
				|  	  | Jmoorthy wrote: |  	  | How to allocate a dynamic tape dataset ? Please advise in this regard
 | 
 
 Jmoorthy,
 
 You canNOT allocate a dynamic tape dataset.
 
 Kolusu
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Jmoorthy Beginner
 
 
 Joined: 23 Aug 2007
 Posts: 5
 Topics: 1
 
 
 | 
			
				|  Posted: Wed Aug 29, 2007 11:58 pm    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| Jmoorthy Beginner
 
 
 Joined: 23 Aug 2007
 Posts: 5
 Topics: 1
 
 
 | 
			
				|  Posted: Thu Aug 30, 2007 12:11 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| jim haire Beginner
 
 
 Joined: 30 Dec 2002
 Posts: 140
 Topics: 40
 
 
 | 
			
				|  Posted: Tue Nov 23, 2021 12:33 pm    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Tue Nov 23, 2021 3:40 pm    Post subject: |   |  
				| 
 |  
				|  	  | 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
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| haatvedt Beginner
 
 
 Joined: 14 Nov 2003
 Posts: 66
 Topics: 0
 Location: St Cloud, Minnesota  USA
 
 | 
			
				|  Posted: Fri Dec 31, 2021 1:52 am    Post subject: |   |  
				| 
 |  
				| 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 |  | 
	
		|  | 
	
		|  | 
	
		|  |