ListPara

Need a listing of all of the paragraph names in your current open COBOL source? This handy command file will create a list into a temporary file, download it to your PC, and then display it using ViewClip.


LISTPARA.CMD
------------
parm  parasearch="---",window="Y"
option nolist
echo ListPara   copyright 1997 Robelle Solutions Technology Inc.
echo Written by Ken Robertson
if "!parasearch" = "?" then
   echo usage:  listpara {search_string}
   echo
   echo   This command file will list paragraphs in the current open
   echo   qedit file.  It really only works for COBOL programs.
   echo
   echo   If search_string is specified, the resulting list will display
   echo   the number of entries found and the filtered list.
   echo
   return
endif
comment  Get the current file name.  This is tricky!
:/ver open > opentmp
print opentmp;start=1;end=1 > paratemp
setjcw cierror 0
:/ver zz > tempzz
/zz */*             {save the current line number}
continue
/findq "procedure division" (8/25 ups) [
if cierror <> 0 then
   echo Warning:  No Procedure Division Found
   /lq [
endif
if "!parasearch"="---" then
   if "!window" = "Y" then
      :/l "~?"(7/8 pat) */ >> paratemp
   else
      /lj "~?"(7/8 pat) */
   endif
else
:  /l  "~?"(7/8 pat) */ > paratemp
:  /l paratemp "!parasearch" > paratems
   setvar entry_cnt finfo("paratemp","eof") - 1
   setvar search_result finfo("paratems","eof")
   echo &dDNumber of paragraphs searched: !entry_cnt  &
Resulting matches:  !search_result
   if "!window" <> "N" then
      if !search_result < 22 then
         :/lq paratemp "!parasearch"
      else
         :/lqj paratemp "!parasearch"
      endif
   endif
   deletevar search_result
   deletevar entry_cnt
endif
if "!window" = "Y" then
   /reflect receive paratemp.txt from paratemp delete ascii
   /reflect shell c:\robelle\viewclip paratemp.txt
endif
:/list zz > $null    {goback to where we were}
:/use zz > $null

....Back to the Qedit Q&A Page