The information in this article applies to:
Product: MIM and PM4Data
Version: 8.x
Platform: z/OS
Discussion
This article discusses the use of dynamic allocation of datasets and the use of the release option. The release option tells the z/OS system to give unused space back to the system.
Example 1 shows the use of the RELEASE option. The example allocates the file, opens it in write mode, and then closes it. The RELEASE attribute is set so that during the close, the total primary/secondary extents will be set to their minimal values.
Note: The file must be opened and closed before the space is released.
Example 1: XMFile main() \{ // Test the XMFile dynamic allocation attributes var xmoPolicy = XMObject::create("Policy"); // File xmoPolicy.setMetadata("type", "file"); xmoPolicy.name = "SYSMAG.TST.RLSE2"; xmoPolicy.File.convert = "yes"; // Dynamic Allocation // RELEASE is only applicable when creating a new dataset (i.e. writeMode) var xmoDynamicAllocation = XMObject::create("Dataset"); xmoDynamicAllocation.SUNIT = "TRK"; xmoDynamicAllocation.PRIMARY = "10"; xmoDynamicAllocation.SECONDARY = "1"; xmoDynamicAllocation.DISP = "NEW"; xmoDynamicAllocation.RELEASE = "TRUE"; xmoDynamicAllocation.DSNAME = "SYSMAG.TST.RLSE2"; xmoDynamicAllocation.BLKSIZE = "0"; xmoDynamicAllocation.DSORG = "PS"; xmoDynamicAllocation.LRECL = "80"; xmoDynamicAllocation.RECFM = "FB"; xmoDynamicAllocation.UCBTYPE = "D"; xmoDynamicAllocation.DEVICE = "SYSDA"; xmoPolicy.File.insert(xmoDynamicAllocation); cout << "Policy: " << xmoPolicy << endl; cout << "Creating XMFile instance..." << endl; var writeFile = new XMFile(xmoPolicy, XMFile::writeMode, XMFile::record); cout << "Opening file..." << endl; writeFile.open(); cout << "Closing file..." << endl; writeFile.close(); return(0); \}
Example 2 calls directly into the XMDynamicAllocation component.
Note: Because the file is never explicitly opened or closed, the file will be allocated with the primary/secondary extents as specified. The space will not be released!
Example 2: XMDynamicAllocation main() \{ // Test the XMDynamicAllocation attributes var xmoDynamicAllocation = XMObject::create("Dataset"); xmoDynamicAllocation.SUNIT = "TRK"; xmoDynamicAllocation.PRIMARY = "10"; xmoDynamicAllocation.SECONDARY = "1"; xmoDynamicAllocation.DISP = "NEW"; xmoDynamicAllocation.RELEASE = "TRUE"; xmoDynamicAllocation.DSNAME = "SYSMAG.TST.RLSE3"; xmoDynamicAllocation.BLKSIZE = "0"; xmoDynamicAllocation.DSORG = "PS"; xmoDynamicAllocation.LRECL = "80"; xmoDynamicAllocation.RECFM = "FB"; xmoDynamicAllocation.UCBTYPE = "D"; xmoDynamicAllocation.DEVICE = "SYSDA"; cout << "Policy: " << xmoDynamicAllocation << endl; cout << "Creating XMDynamicAllocation instance..." << endl; var xmda = new XMDynamicAllocation(); var rc = xmda.allocate(xmoDynamicAllocation); if (rc != 0) \{ cout << "Failed to execute allocate, rc = " << rc << endl; \} else \{ cout << "Successfully executed allocate." << endl; \} return(0); \}