!
! SLMEXTMOD.CMD - SOURCE LIBRARY EXTRACT-MODULE AND SLIB PROCEDURE DEF
!
! EDIT NUMBER = 0001
! EDITED BY: D.B.CURTIS  8 APR 80  17:22
!
!
DELETE SLIB;
DEFINE PROCEDURE SLIB
SET DICTIONARY LB:[20,25]SLIB
END-PROCEDURE
DEFINEP SLIB 2,UIC,[*,*],R
!
SET DICTIONARY SLIB
DELETE EXTRACT-MODULE;
DEFINE PROCEDURE EXTRACT-MODULE
 READY INIT-DOM
 FIND INIT IN INIT-DOM
 SELECT FIRST INIT
 READY MODS READ
 READY MODHIST READ
 PRINT "EXTRACT MODULE PROGRAM"
 FIND A IN MODS WITH SUB-PROJECT = INIT.ISP AND PROCESS = *.PROCESS AND
	MODULE-TITLE = *.MODULE
 SELECT FIRST A
 DISPLAY "WAS A MODULE FOUND?"
 IF *.ANS NE "Y" THEN FIND A IN MODS WITH SUB-PROJECT = "JUNK";
 PRINT "MODULE",MODULE-TITLE(-),"LAST INSERTED",LAST-INSERTION-DATE(-),
	"CURRENT IDENT IS",MODULE-IDENT(-),SKIP 1,
	"MODULE HAS BEEN ACCESSED",ACCESS-NUMBER(-) USING ZZ9,
	"TIMES",SKIP 1,"CURRENTLY THIS MODULE:"
 IF STATUS EQ "INITAL" THEN PRINT "HAS NOT BEEN ACCESSED FOR REVISION" ELSE
	IF STATUS EQ "UPDAT" THEN PRINT " *** IS BEING UPDATED ***" ELSE
	IF STATUS EQ "REVIS" THEN PRINT " === HAS BEEN REVISED" ELSE
	FIND A IN MODS WITH SUB-PROJECT = "JUNK"
 PRINT "MODULE HISTORY FOLLOWS:"
 PRINT ALL DATE-EXTRACTED ("EXTDATE"),
	MODULE-IDENT-EXTRACTED("EXTID"),"[",GROUP(-),",",MEMBER(-),"]",
	EXTRACTORS-NAME("BY"),STATUS(-),
	COMMENT USING X(10) OF MODHIST WITH
	SUB-PROJECT = A.SUB-PROJECT AND PROCESS = A.PROCESS AND
	MODULE-TITLE= A.MODULE-TITLE
 DISPLAY "IS THIS THE MODULE YOU WISH?"
 IF *.ANS NE "Y" THEN FIND A IN A WITH SUB-PROJECT = "JUNK"
 READY MODHIST WRITE
 STORE MODHIST USING BEGIN
	SUB-PROJECT = A.SUB-PROJECT
	PROCESS = A.PROCESS
	MODULE-TITLE = A.MODULE-TITLE
	TRACE = "     "
	MODULE-IDENT-EXTRACTED = A.MODULE-IDENT
	DATE-EXTRACTED = INIT.IDAT
	GROUP = INIT.IGR
	MEMBER = INIT.IME
	EXTRACTORS-NAME = INIT.INAM
	 DISPLAY " IS THIS FOR EXAMINATION (E) OR REVISION (R)"
	IF *.ANS EQ "R" THEN BEGIN
		STATUS = "EXTREV"
	END ELSE STATUS = "EXTEXM"
	COMMENT = *.COMMENT
	ACCESID = A.ACCESS-NUMBER
	END VERIFY USING BEGIN
	PRINT GROUP(-),MEMBER(-),STATUS(-),COMMENT(-) USING X(30)
	DISPLAY "CONFIRM WITH Y IF OK"
	IF *.CONFIRM NE "Y" THEN ABORT "ABORTED"
 END
 READY MODHIST READ
FIND B IN MODHIST WITH SUB-PROJECT = A.SUB-PROJECT AND PROCESS = A.PROCESS AND
	MODULE-TITLE = A.MODULE-TITLE AND ACCESID = A.ACCESS-NUMBER
 SELECT LAST B
 READY MODS MODIFY
MODIFY USING BEGIN
	ACCESS-NUMBER = ACCESS-NUMBER + 1
	IF B.STATUS = "EXTREV" THEN STATUS ="UPDAT"
	END OF A
 READY MODS READ
 PRINT MFILE(-),"=[",SLGROUP(-),",",SLMEMBER(-),"]",SLFILE(-),".",SLEXT(-),
	"/EX:",MODULE-TITLE(-), SKIP 1,
	"[",SLGROUP(-),",",SLMEMBER(-),"]",SLFILE(-),".",SLEXT(-),
	"/MH:",MODULE-TITLE(-),":",MODHIG(-),":",MODLOW(-),":ACC:"  ON LIBEXTDTR.TMP
END-PROCEDURE
DEFINEP EXTRACT-MODULE 2,UIC,[*,*],R
