User storage is associated exclusively with the issuing task through the TCE; when the task terminates, user storage is released. By dynamically acquiring only the amount of storage needed, you can make more effective use of storage resources.
Steps to Acquire User Storage
To dynamically acquire and use variable storage from the storage pool within a single task, perform the following steps:
Example of Acquiring User Storage
The program excerpt below shows the acquisition and release of user storage.
The program acquires the minimum amount of storage needed to complete the processing specified by the user.
DATA DIVISION. LINKAGE SECTION. 01 COPY IDMS RECORD EMPLOYEE. 05 EMPLOYEE-END PIC X. 01 COPY IDMS RECORD DEPARTMENT. 05 DEPARTMENT-END PIC X. 01 ERROR-DATA. 05 ERROR-DEPT-ID PIC 9(4). 05 ERROR-MESSAGE-CODE PIC X(4). 05 ERROR-DATA-END PIC X. PROCEDURE DIVISION. MAIN-LINE. *** THIS PROGRAM ACQUIRES STORAGE FOR EITHER THE *** *** DEPARTMENT RECORD OR THE EMPLOYEE RECORD *** *** DEPENDING ON THE CONTROL KEY PRESSED BY THE *** *** TERMINAL OPERATOR. *** BIND MAP SOLICIT. BIND MAP SOLICIT RECORD SOLICIT-REC. MAP IN USING SOLICIT. INQUIRE MAP SOLICIT MOVE AID TO DC-AID-IND-V. IF CLEAR-HIT DC RETURN ELSE IF PA01-HIT GO TO A100-GET-EMPLOYEE ELSE IF PA02-HIT GO TO A100-GET-DEPARTMENT ELSE GO TO U100-ERROR-PROC. * A100-GET EMPLOYEE. IF SOLICIT-EMP-ID NOT NUMERIC GO TO U200-ERROR-EMP-ID. *** ACQUIRE USER STORAGE FOR THE EMPLOYEE RECORD *** GET STORAGE FOR EMPLOYEE TO EMPLOYEE-END NOWAIT SHORT USER STGID 'EMPL' VALUE IS LOW-VALUE ON DC-NEW-STORAGE NEXT SENTENCE. MOVE SOLICIT-EMP-ID TO EMP-ID-0415. OBTAIN CALC EMPLOYEE ON DB-REC-NOT-FOUND GO TO U200-ERROR-NO-EMP. .
Copyright © 2013 CA.
All rights reserved.
|
|