On: Wed, Jun 18, 2008 at 02:06:30PM -0400,Jim Bohnsack Wrote:

} Pat--You should also look at the CMS DIRMAP program.  I usually use it 
} with the USER BACKUP file that DIRMAINT puts on it's 1DB disk so it's 
} what the system looked last night or whenever you have it generated.  If 
} I want an up-to-the-minute file, I do a DIRM USER BACKUP and then run 
} DIRMAP.  I think it will provide you with the information you want 
} without having to figure out how to cope with the asynchronous output 
} from the DIRMAINT DIRMAP command.

Good idea except that DIRMAP has one design flaw.  It does not show gaps
if they are at the end of the volume,  and that is oftem where the most
"interesting" gaps lie.  My fix is to run the DIRMAP, and post process
it with an xedit macro called GAPMAP which follows.  I also have an exec
DMAP and another macro which together with GAPMAP do the whole mapping job. 
QUERY DASD DETAILS is used to find the actual number of cyls.  I am reluctant
to post DMAP because its fairly large and contains some bits which are
specific to my last job.  I will send it off list on request along with
FIXMAP (the other macro).

/*
  GAPMAP
  This macro will fix up the o/p of DISKMAP by:
     1) Checking the end cyl of the last line for each volume
        against the actual size of the volume and adding in a
        "GAP" if needed.
     2) Adding in the VOLSER on each "GAP" line.
*/

false = (1=0)
true  = (1=1)
Trace O

/*
  If MSGMODE is on, turn it off (and restore later) to
  suppress the 'Target not found" at the end.
*/
'EXTRACT /MSGMODE/LINE/'
start_line = line.1
'SET MSGMODE OFF'
'SET WRAP OFF'
'SET CASE MIXED RESPECT'

/*
  Phase 1:
  For each volume, add a gap at the end if needed.
*/
'TOP'
vsn = ''
do forever
   'FIND VOLUME'                      /* Next volume. */
   if rc ^= 0
      then leave
   'NFIND ______'                     /* Get                           */
   'EXTRACT /CURLINE/'                /*  the                          */
   vsn = translate(left(curline.3,6)) /*    volser.                    */
   parse value diagrc(8,'QUERY DASD' vsn, 80) with cp_rc . . cuu err '15'x
   if cp_rc ^= 0 | err = 'was not found.'  /* Error?                   */
      then iterate                    /* Yes, ignore this vol.         */
   parse value diagrc(8,'QUERY DASD DETAILS' cuu) with cp_rc . ,
      'CYLS =' ncyl '15'x
   if cp_rc ^= 0                      /* Error?                        */
      then iterate                    /* Yes, ignore this vol.         */
   ncyl = strip(ncyl, 'L')            /* Drop leading blanks.          */
   'FIND ___________________________________________________'
                                      /* Locate next blank.            */
   if rc ^= 0                         /* Error?                        */
      then iterate                    /* Yes, ignore this vol.         */
   '-1'                               /* Up one.                       */
   'EXTRACT /CURLINE/'                /* Get last non-blank line.      */
   ecyl = word(substr(curline.3,9),5) /* Ending cyl of last MDISK.    */
   if ecyl >= ncyl-1                  /* Does it end on last cylinder? */
      then iterate                    /* Its OK, try next volume.      */
   scyl = right(ecyl + 1,8)
   ecyl = right(ncyl - 1,8)
   qcyl = right(ncyl - scyl,8)
   'INPUT' copies(' ',33) scyl ecyl qcyl '   GAP'
end

/*
  Phase 2:
  Scan the file, picking up each volser as I come to it,
  and overlaying it (lower cased) on each "GAP" line.
*/
':1'             /* Start 1 down to avoid the timestamp. */
vsn = ''
do forever
   '+1'
   if rc ^= 0
      then leave
   'EXTRACT /CURLINE/'
   temp = left(curline.3,6)
   select
      when curline.3 = ''
         then iterate
      when temp = ''
         then nop
      when temp = '------'
         then iterate
      when temp = 'VOLUME'
         then do
             'EXTRACT /LINE/'
             'NFIND ______'
             'EXTRACT /CURLINE/'
             vsn = left(curline.3,6)
             vsn = translate(vsn,'abcdefghijklmnopqrstuvwxyz', ,
                                 'ABCDEFGHIJKLMNOPQRSTUVWXYZ')
             ':'line.1
             iterate
             end
      otherwise
         nop
   end
   if word(curline.3,words(curline.3)) = 'GAP'
      then do
           if vsn = old_vsn
              then do
                   'EXTRACT /LINE/'
                   'FINDUP' vsn
                   'OVERLAY       *'
                   ':'line.1
                   'OVERLAY' vsn'*'
                   end
              else do
                   'OVERLAY' vsn
                   old_vsn = vsn
                   end
           end
end

/*
  All done with GAPMAP processing.
  If I have been called from an exec, push a FILE.
  If I am interactive, just restore the MSGMODE, and exit.
  Make a guess at this by checking if the TERMINAL is in
  TYPEWRITER or DISPLAY mode.
  This works because an exec would (normally) call XEDIT
  with the "NOSCREEN" option.
*/
'EXTRACT /TERMINAL/'
if terminal.1 = 'TYPEWRITER'
   then do
        push 'COMMAND FILE'
        push 'SET RECFM V'
        end
   else do
        'SET RECFM V'
        'SET MSGMODE' msgmode.1
        ':'start_line
        end
exit



-- 
Rich Greenberg  N Ft Myers, FL, USA richgr atsign panix.com  + 1 239 543 1353
Eastern time.  N6LRT  I speak for myself & my dogs only.    VM'er since CP-67
Canines:Val, Red, Shasta & Casey (RIP), Red & Zero, Siberians  Owner:Chinook-L
Retired at the beach                                     Asst Owner:Sibernet-L

Reply via email to