COMPILE ROUTINE LOAD_EPI_SPEC(Dummy)
ROWDEF(CHARSTR)


DECLARE SUBROUTINE Send_Dyn

DECLARE FUNCTION obj_Prod_Spec

$INSERT PROD_SPEC_EQU
$INSERT QUOTE_SPEC_EQU


OPEN 'PROD_SPEC' TO PSNTable ELSE 
	DEBUG
	GOTO Bail
END

OPEN 'EPI_SPEC' TO EpiSpecTable ELSE
	DEBUG
	GOTO Bail
END

SELECT PSNTable

RecCnt = 0
Done = 0

LOOP
	READNEXT PSNo ELSE Done = 1
UNTIL Done
	READ PSRec FROM PSNtable,PSNo THEN
		LayerSpecs = obj_Prod_Spec('GetLayerProp',PSNo:@RM:@RM:1)
		
		LayerCnt = COUNT(LayerSpecs,@RM) + (LayerSpecs NE '')
		
		LayerNos = ''
		
		FOR I = 1 TO LayerCnt
			LayerSpec	= FIELD(LayerSpecs,@RM,I)		;* Take the Ith Layer
			LayerSet	= FIELD(LayerSpec,@FM,1)
			LayerSpec	= FIELD(LayerSpec,@FM,2,99)	;* LayerSpec without the LayerSet
			
			LayerNo = ''
			IF LayerCnt = 1 THEN
				LayerNo = 1
			END ELSE
			
				IF NOT(NUM(LayerSet)) THEN
					IF LayerSet[1,1] = 'L' THEN
						LayerSet[1,1] = ''
						LayerNo = LayerSet
					END
				END
			END
			
			IF LayerNo NE '' THEN LayerNos<1,-1> = LayerNo
		NEXT I
		
		Send_Dyn(PSNo:' ':LayerNos)
		

	END	;* End of PSRec Read
REPEAT





* * * * * * * 
Bail:
* * * * * * *

END
