Reference Guide > D Routines > DELCOM Procedure
  

DELCOM Procedure
Deletes one or more COMMON blocks from the PV-WAVE session.
 
warning
The routines DELSTRUCT, DELCOM, DELPROC, and DELFUNC are provided as convenience routines for PV-WAVE developers. They allow developers to delete or reset certain elements of PV-WAVE's internal memory, which would otherwise require a restart of the PV-WAVE session. They are only used at the $MAIN$ level, i.e., at the WAVE> prompt. Any other use results in session instability and undefined results.
Usage
DELCOM, blockname1, ..., blocknameN
Input Parameters
blocknameA string containing the name of a COMMON block to delete.
Keywords
AllIf present and non-zero, removes all currently defined COMMON blocks from the PV-WAVE session.
List — (Output) A variable in which to return the names of all COMMON blocks defined in the current PV-WAVE session. If this keyword is present all other parameters and keywords are ignored. If no COMMON blocks are declared in the current PV-WAVE session, a message is printed and the output variable is unchanged.
Discussion
This procedure is primarily used during code development while you are still modifying the COMMON blocks you wish to use in your application. It allows you to re-define a COMMON block and its associated variables without restarting your PV-WAVE session.
Deleting a COMMON block causes all functions and procedures which use the affected COMMON block(s) to be removed from memory. The variables contained in the COMMON block are deleted as well. The memory for each is returned to the system.
This procedure may only be called from the $MAIN$ level.
Example
; Create two routines that share a COMMON block.
; Save this procedure in a file called t_com1.pro.
PRO t_com1
   COMMON t_com, a, b, c, d
   a = 23i
   b = 12
   c = a + b
END
 
; Save this function in a file called t_com2.pro.
FUNCTION t_com2
   COMMON t_com, a, b, c, d
   a = 100
   RETURN, a
END
 
; In your PV-WAVE session, declare two common blocks at the $MAIN$ level.
COMMON testcom1, a, b, c, d
COMMON testcom2, e, f, g
 
; Compile the two routines above, placing them in memory and creating
; the t_com COMMON block in the PV-WAVE session.
.run t_com1
.run t_com2
 
; Print information about the $MAIN$ level of the current session. 
; Note that the t_com COMMON block is not listed as it is
; not declared at the $MAIN$ level.
INFO
 
; PV-WAVE prints:
;
; % At $MAIN$  .
; Code area used: 0.00% (0/768),  Data area used: 1.40% (112/8000)
; # local variables (including 0 parameters): 0/493
; # common symbols: 7/7
; A (TESTCOM1)    UNDEFINED = <Undefined>
; B (TESTCOM1)    UNDEFINED = <Undefined>
; C (TESTCOM1)    UNDEFINED = <Undefined>
; D (TESTCOM1)    UNDEFINED = <Undefined>
; E (TESTCOM2)    UNDEFINED = <Undefined>
; F (TESTCOM2)    UNDEFINED = <Undefined>
; G (TESTCOM2)    UNDEFINED = <Undefined>
; Common Blocks: 
; 	TESTCOM1(4)		TESTCOM2(3)	
; Saved Procedures:
;          SETDEMO     SETDEMO_MSNT     SETKEYS_MSNT       SETUP_KEYS
;          T_COM1
; Saved Functions:
;           REVERSE          STRJOIN         STRSPLIT           T_COM2
 
; Use DELCOM to get a list of all the declared COMMON blocks
; in the current PV-WAVE session
DELCOM, List=out
PRINT, out
 
; PV-WAVE prints:
; TESTCOM1 TESTCOM2 T_COM
 
; Delete all of the COMMON blocks
DELCOM, /All
 
; Re-examine the info for the $MAIN$ level
INFO
 
; PV-WAVE prints:
;
; % At $MAIN$  .
; Code area used: 0.00% (0/768),  Data area used: 1.60% (128/8000)
; # local variables (including 0 parameters): 1/500
; # common symbols: 0/0
; OUT             STRING    = Array(3)
; Saved Procedures:
;          SETDEMO     SETDEMO_MSNT     SETKEYS_MSNT       SETUP_KEYS
; Saved Functions:
;          REVERSE          STRJOIN         STRSPLIT
;
; The COMMON blocks at the $MAIN$ level and their variables have been 
; deleted along with the routines that used the t_com COMMON block.
; Note that while the memory for the COMMON blocks and their variables
; is released to the system, the data area they occupied in the $MAIN$
; procedure is held for re-use.
 
; Verify deletion using DELCOM
out = -1
DELCOM, list=out
 
; PV-WAVE prints:
; % DELCOM: No COMMON blocks found
 
INFO, out
 
; PV-WAVE prints:
; OUT             INT       =       -1
 
; Re-define the $MAIN$ level COMMON blocks with additional variables
COMMON testcom1, a, b, c, d, newvar1
COMMON testcom2, e, f, g, newvar2
 
; Check the INFO
INFO
 
; PV-WAVE prints:
;
; % At $MAIN$  .
; Code area used: 0.00% (0/768),  Data area used: 2.00% (160/8000)
; # local variables (including 0 parameters): 1/491
; # common symbols: 9/9
; A (TESTCOM1)    UNDEFINED = <Undefined>
; B (TESTCOM1)    UNDEFINED = <Undefined>
; C (TESTCOM1)    UNDEFINED = <Undefined>
; D (TESTCOM1)    UNDEFINED = <Undefined>
; E (TESTCOM2)    UNDEFINED = <Undefined>
; F (TESTCOM2)    UNDEFINED = <Undefined>
; G (TESTCOM2)    UNDEFINED = <Undefined>
; OUT             INT       =       -1
; NEWVAR1 (TESTCOM1) UNDEFINED = <Undefined>
; NEWVAR2 (TESTCOM2) UNDEFINED = <Undefined>
; Common Blocks: 
;	TESTCOM1(5)		TESTCOM2(4)	
; Saved Procedures:
;           SETDEMO     SETDEMO_MSNT     SETKEYS_MSNT       SETUP_KEYS
; Saved Functions:
;           REVERSE          STRJOIN         STRSPLIT
;
; Note that the data area used grew to accommodate only the added variables.
 
; Delete the testcom2 COMMON block.
DELCOM, "testcom2"
 
; Show the info
INFO
 
; PV-WAVE prints:
; % At $MAIN$  .
; Code area used: 0.00% (0/768),  Data area used: 2.00% (160/8000)
; # local variables (including 0 parameters): 1/495
; # common symbols: 5/5
; A (TESTCOM1)    UNDEFINED = <Undefined>
; B (TESTCOM1)    UNDEFINED = <Undefined>
; C (TESTCOM1)    UNDEFINED = <Undefined>
; D (TESTCOM1)    UNDEFINED = <Undefined>
; OUT             INT       =       -1
; NEWVAR1 (TESTCOM1) UNDEFINED = <Undefined>
; Common Blocks: 
;   TESTCOM1(5) 
; Saved Procedures:
;           SETDEMO     SETDEMO_MSNT     SETKEYS_MSNT       SETUP_KEYS
; Saved Functions:
;           REVERSE          STRJOIN         STRSPLIT
 

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.