

PROC makqcu_phase_7, makqcu7 (
qcu: name = $required
base: name = $required
status )

crev ignore k=status
crev qi k=string v=$string($value(qcu))
crev bi k=string v=$string($value(base))
crev work k=string
crev msg k=string
crev count v=1
crev wev$working_catalog k=string s=xref

crev q_path  k=string v='.'//$job(user)//'.'//$strrep(bi)
crev qcu_path k=string v=':CSERV.CSERV.DEBUG_TABLES.'//$strrep(bi)//'_QCU'
crev temp  k=string v='.'//$job(user)//'.'//$strrep(qi)//'_SCR.$ASIS'
crev temp1 k=string v=$unique//'.$ASIS'
crev nl_path  k=string v='.'//$job(user)//'.'//$strrep(qi)//'_NL'
crev nam_path  k=string v='.'//$job(user)//'.'//$strrep(bi)//'.NAMES'
crev pl_path k=string v='.'//$job(user)//'.'//$strrep(qi)//'_PL'
crev na_path k=string v='.'//$job(user)//'.'//$strrep(qi)//'_NA'
crev cb_path k=string v='.'//$job(user)//'.'//$strrep(qi)//'_CB'

delf $fname(pl_path) status=ignore
delf $fname(na_path) status=ignore
delc $fname(cb_path) do=cac status=ignore

crev break k=string v='_'
crev temp k=string v=$unique//'.$asis'
crev link_path k=string

RESPF l=$fname(temp)
DISBF BF=$fname(qcu_path)
QUIT

crev counter
rewf $fname(temp) status=ignore
WHILE counter < 2 DO
 accl v=work i=$fname(temp) lc=count
 IF $substr(work,2,1) = ':' THEN
  counter = counter + 1
 IFEND
WHILEND

crev base_path k=string
crev name_path k=string
crev head_path k=string

link_path = work
count = $scan_string(break,work)
count = count -1
base_path = $substr(work,1,count)
name_path = base_path//'_names'
head_path = base_path//'_pl'

RESPF l=$fname(temp)
RESC c=$fname(link_path) ncn=$fname(cb_path) bf=$fname(qcu_path)
RESF f=$fname(name_path) nfn=$fname(na_path) bf=$fname(qcu_path)
RESF f=$fname(head_path) nfn=$fname(pl_path) bf=$fname(qcu_path)
QUIT



delcc $fname(q_path) status=ignore
delc $fname(q_path) status=ignore
delf $fname(temp) status=ignore
detf $fname(a_path) status=ignore


crev name k=string


"*************************************************************************
" This section restores the QCU Catalog from CSERV to the
" users catalog to prepare the new QCU base. The first section determines
" the name of the catalog in the CSERV.DEBUG_TABLES catalog.
"*************************************************************************
work = 'RESPF,l='//temp
work = work//'; DISBF bf='//qcu_path
work = work//'; QUIT'
incl work

detf $fname(temp) status=ignore
attf $fname(temp) status=ignore


"**************************************************************************
" Position to 2nd occurance of colon, this will be first catalog entry
"**************************************************************************
crev cc   v=0
WHILE CC <> 2 DO           "loop until 2nd occurance of :
accl v=work i=$fname(temp) lc=count
  IF $substr(work,2,1) = ':' THEN
    cc = cc+1
  IFEND
WHILEND

    putl ' Acquiring predecessor base from '
    putl '  '//qcu_path
    rewf $fname(temp)
    msg = 'RESPF l=$null;'
    msg = msg//'RESC bf='//qcu_path//',c='
    msg = msg//$substr(work,2,$strlen(work)-1)
    msg = msg//',ncn='//q_path
    msg = msg//';QUIT'
    incl msg

  detf $fname(q_path) status=ignore
  detf $fname(ic_path) status=ignore
  delf $fname(temp) status=ignore
  detf $fname(nl_path) status=ignore
  delf $fname(nl_path) status=ignore


"******************************************************************************
" Copy in the names list.
"******************************************************************************
  copf $fname(nam_path) $fname(nl_path)
  detf $fname(nl_path) status=ignore


PROCEND makqcu_phase_7
