.;
.;	TATGEN.CMD
.;
.;	Interfaces with PHASE4 to build and/or move TAT to the target
.;
.ENABLE SUBSTITUTION
.ENABLE GLOBAL
.;
.;
	.SETN EXSTAT 1				! Assume success
	.SETF MAP				! Assume no map desired
	.IF $MAP NE ""	.SETT MAP
	.TESTFILE TAT.TSK
	.IF <FILERR> NE 1	.GOTO GEN
.;
	.IFF MAP		.GOTO MOVE
	.TESTFILE TAT.MAP
	.IF <FILERR> EQ 1	.GOTO MOVE
.;
.;    Assemble TAT
.GEN:
	MAC TAT,TAT/-SP=DB:[1,1]EXEMC/ML,'<SYDISK>''<SYUNIT>':'<UIC>'TAT
	.IF <EXSTAT> NE 1	.GOTO ERROR
.;
.;    Taskbuild TAT
	TKB @TATBUILD
	.IF <EXSTAT> NE 1	.GOTO ERROR
.;
.;    Move .TSK and (.IFT MAP) .MAP files
.MOVE:
	@'$P4LOC'MOVE TAT.TSK '$TSK'
	.IF <EXSTAT> NE 1	.GOTO MOVERR
	.IFT MAP @'$P4LOC'MOVE TAT.MAP '$MAP'
	.IF <EXSTAT> NE 1	.GOTO MOVERR
.;
.;    Clean up directory
	DEL TAT.LST;*/NM
	DEL TAT.OBJ;*/NM
.;
.;    Exit with status
.EXIT:
	.EXIT EXSTAT
.;
.;
.;    Error moving to target
.MOVERR:
	.SETS $LGLIN "Error moving files to target"
.;
.;    Other error
.ERROR:
	.SETN EXSTAT 2
	.GOTO EXIT
