30-Nov-2009

Cool DCL tricks

I mentioned this feature when it was unofficially announced but I haven't mentioned it since. As it's pretty cool, it deserves a little writeup.

Did you know that is you have the appropriate privileges, you can issue a CTRL-T against another process? Even another process on another node of the cluster? All you need to do is define a DCL symbol called DCL$CTRLT_PID to be the PID of the target process. Then hitting CTRL-T returns information on that process rather than your current process.

The second part of this is that you can modify the output that CRTL-T produces. To do this, you define a DCL symbol called DCL$CTRLT. Here's an example of doing this in a DCL command procedure (lifted from the release notes):


$       inner = 0
$       outer = 0
$loop:
$loop1:
$       if inner .gt. 20000
$       then
$           goto end_loop1
$       endif
$       inner = inner + 1
$       dcl$ctrlt = F$FAO ("Inner count is !SL !/ Outer count is !SL", -
                           inner, outer)
$       goto loop1
$end_loop1:
$       inner = 0
$       outer = outer + 1
$       goto loop

Even more interestingly, you can use this technique from within a program and display variable information:


#include <stdio.h>
#include <stdlib.h>
#include <descrip.h>
#include <stsdef.h>
#include <lib$routines.h>

int main (void) {

static int r0_status;
static int count = 0;
static $DESCRIPTOR (symbol_d, "DCL$CTRLT");
static char value[256];
static struct dsc$descriptor_s value_d = { 0,
                                           DSC$K_DTYPE_T,
                                           DSC$K_CLASS_S,
                                           value };

    while (TRUE) {

        value_d.dsc$w_length = sprintf (value, "Count is %d", ++count);
        r0_status = lib$set_symbol (&symbol_d, &value_d);
        if (!$VMS_STATUS_SUCCESS (r0_status)) {
            (void)lib$signal (r0_status);
        }
    }
}

Posted at November 30, 2009 2:54 PM
Tag Set:
Comments

Remote Control T documented in V8.3 NF
http://h71000.www7.hp.com/doc/83final/6679/6679pro_001.html#ctrltremote

Customising Control T output documented at
http://h71000.www7.hp.com/doc/83final/6679/6679pro_001.html#ctrltout

Posted by: Ian Miller at December 1, 2009 11:30 PM

Comments are closed