COMPILE FUNCTION obj_Labels(Method,Parms)
/*
	Methods common to all Zebra labels
    
	09/12/2003 JCH - Initial Coding
     
    Properties:
     
    Methods:
    
    VerifyParms(DataStruct)		;* Values to be printed @FM delimited (see Lables insert)
   
*/


DECLARE FUNCTION Get_Status, Msg
DECLARE FUNCTION Utility
DECLARE SUBROUTINE  Set_Status, Msg

$INSERT MSG_EQUATES
$INSERT LABELS


ErrTitle = 'Error in Stored Procedure "obj_Labels"'
ErrorMsg = ''

IF NOT(ASSIGNED(Method))	THEN ErrorMsg = 'Unassigned parameter "Method" passed to subroutine'
IF NOT(ASSIGNED(Parms))		THEN Parms = ''

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

Methods  = 'VerifyParms'

Result = ''

LOCATE Method IN Methods USING @FM SETTING Pos THEN
	ON Pos GOSUB VerifyParms
END

IF ErrorMsg NE '' THEN
	Set_Status(-1,ErrTitle:@SVM:ErrorMsg)
	RETURN ''
END

RETURN Result

* * * * * * *
VerifyParms:
* * * * * * *


DataVals = Parms[1,@RM]

IF DataVals<Label$CustPartNo> NE '' THEN
	CustPartNo = DataVals<Label$CustPartNo>		;* 18 alphanumeric
	IF LEN(CustPartNo) > 18 THEN
		ErrorMsg = 'Customer Part Number ':QUOTE(CustPartNo):' exceeds 18 characters.'
	END
END

IF DataVals<Label$PartQty> NE '' THEN
	PartQty = DataVals<Label$PartQty>			;* 6 numeric
	IF LEN(PartQty) > 6 THEN
		ErrorMsg = 'Customer Part Number ':QUOTE(PartQty):' exceeds 6 characters.'
	END
	IF NOT(NUM(PartQty)) THEN
		ErrorMsg = 'Customer Part Number ':QUOTE(PartQty):' is not a number.'
	END
END

IF DataVals<Label$RevLvl> NE '' THEN
	RevLvl = DataVals<Label$RevLvl>				;* 3 alphanumeric
	IF LEN(RevLvl) > 3 THEN
		ErrorMsg = 'Customer Part Rev Level ':QUOTE(RevLvl):' exceeds 3 characters.'
	END
END

IF DataVals<Label$SerialNo> NE '' THEN
	SerialNo = DataVals<Label$SerialNo>				;* 9 alphanumeric
	IF LEN(SerialNo) > 9 THEN
		ErrorMsg = 'EDI Transaction Serial No ':QUOTE(SerialNo):' exceeds 9 characters.'
	END
END

IF DataVals<Label$SupplierCd> NE '' THEN
	SupplierCd = DataVals<Label$SupplierCd>				;* 12 alphanumeric
	IF LEN(SupplierCd) > 12 THEN
		ErrorMsg = 'Supplier Code ':QUOTE(SupplierCd):' exceeds 12 characters.'
	END
END

IF DataVals<Label$DeliveryLoc> NE '' THEN
	DeliveryLoc = DataVals<Label$DeliveryLoc>				;* 8 alphanumeric ('VARIOUS' is OK)
	IF LEN(DeliveryLoc) > 8 THEN
		ErrorMsg = 'Delivery Location ':QUOTE(DeliveryLoc):' exceeds 8 characters.'
	END
END

IF DataVals<Label$PONo> NE '' THEN
	PONo = DataVals<Label$PONo>				;* 12 alphanumeric
	IF LEN(PONo) > 12 THEN
		ErrorMsg = 'Purchase Order No ':QUOTE(PONo):' exceeds 12 characters.'
	END
END

IF DataVals<Label$LotNo> NE '' THEN
	LotNo = DataVals<Label$LotNo>				;* 10 alphanumeric
	IF LEN(LotNo) > 10 THEN
		ErrorMsg = 'Vendor Lot No ':QUOTE(LotNo):' exceeds 10 characters.'
	END
END

IF DataVals<Label$PlantDock> NE '' THEN
	PlantDock = DataVals<Label$PlantDock>				;* 7 alphanumeric
	IF LEN(PlantDock) > 7 THEN
		ErrorMsg = 'Plant & Dock designator ':QUOTE(PlantDock):' exceeds 7 characters.'
	END
END

IF DataVals<Label$StorageBin> NE '' THEN
	StorageBin = DataVals<Label$StorageBin>				;* 30 alphanumeric
	IF LEN(StorageBin) > 30 THEN
		ErrorMsg = 'Storage Bin description ':QUOTE(StorageBin):' exceeds 30 characters.'
	END
END

IF DataVals<Label$PlantName> NE '' THEN
	PlantName = DataVals<Label$PlantName>				;* 30 alphanumeric
	IF LEN(PlantName) > 30 THEN
		ErrorMsg = 'Plant Name description ':QUOTE(PlantName):' exceeds 30 characters.'
	END
END

IF DataVals<Label$PlantCity> NE '' THEN
	PlantCity = DataVals<Label$PlantCity>				;* 30 alphanumeric
	IF LEN(PlantCity) > 30 THEN
		ErrorMsg = 'Plant City description ':QUOTE(PlantCity):' exceeds 30 characters.'
	END
END

IF DataVals<Label$ShipDt> NE '' THEN
	ShipDt = DataVals<Label$ShipDt>				;* 30 alphanumeric
	IF NOT(ShipDt MATCHES "2A'/'2A'/'4A") THEN
		ErrorMsg = 'Ship Date in incorrect format ':QUOTE(ShipDt):' should be MM/DD/YYYY'
	END
END

IF DataVals<Label$PartDesc> NE '' THEN
	PartDesc = DataVals<Label$PartDesc>				;* 25 alphanumeric
	IF LEN(PartDesc) > 25 THEN
		ErrorMsg = 'Part description ':QUOTE(PartDesc):' exceeds 25 characters.'
	END
END

IF DataVals<Label$Manufacturer> NE '' THEN
	Manufacturer = DataVals<Label$Manufacturer>				;* 30 alphanumeric
	IF LEN(Manufacturer) > 30 THEN
		ErrorMsg = 'Manufacturer description ':QUOTE(Manufacturer):' exceeds 30 characters.'
	END
END

IF DataVals<Label$City> NE '' THEN
	City = DataVals<Label$City>				;* 20 alphanumeric
	IF LEN(City) > 20 THEN
		ErrorMsg = 'Manufacturer City ':QUOTE(City):' exceeds 20 characters.'
	END
END

IF DataVals<Label$ST> NE '' THEN
	ST = DataVals<Label$ST>				;* 2 characters
	IF NOT( ST MATCHES '2A' ) THEN
		ErrorMsg = 'Manufacturer State Code incorrect ':QUOTE(ST):' should be 2 letters.'
	END
END

IF DataVals<Label$ZIP> NE '' THEN
	ZIP = DataVals<Label$ZIP>				;* 7 alphanumeric
	IF LEN(ZIP) > 7 THEN
		ErrorMsg = 'Manufacturer ZIP ':QUOTE(ZIP):' exceeds 7 characters.'
	END
END

IF DataVals<Label$Country> NE '' THEN
	Country = DataVals<Label$Country>				;* 10 alphanumeric
	IF LEN(Country) > 10 THEN
		ErrorMsg = 'Manufacturer Country of origin ':QUOTE(Country):' exceeds 10 characters.'
	END
END

IF DataVals<Label$MfgDt> NE '' THEN
	MfgDt = DataVals<Label$MfgDt>				;* 30 alphanumeric
	IF NOT(MfgDt MATCHES "2A'/'2A'/'4A") THEN
		ErrorMsg = 'Mfg Date in incorrect format ':QUOTE(MfgDt):' should be MM/DD/YYYY'
	END
END

IF DataVals<Label$ShipToName> NE '' THEN
	ShipToName = DataVals<Label$ShipToName>				;* 25 alphanumeric
	IF LEN(ShipToName) > 25 THEN
		ErrorMsg = 'Ship To Name ':QUOTE(ShipToName):' exceeds 25 characters.'
	END
END

IF DataVals<Label$ShipToAddr> NE '' THEN
	ShipToAddr = DataVals<Label$ShipToAddr>				;* 25 alphanumeric
	IF LEN(ShipToAddr) > 25 THEN
		ErrorMsg = 'Ship To Addr ':QUOTE(ShipToAddr):' exceeds 25 characters.'
	END
END

IF DataVals<Label$ShipToCity> NE '' THEN
	ShipToCity = DataVals<Label$ShipToCity>				;* 25 alphanumeric
	IF LEN(ShipToCity) > 25 THEN
		ErrorMsg = 'Ship To City ':QUOTE(ShipToCity):' exceeds 25 characters.'
	END
END

IF DataVals<Label$ShipToST> NE '' THEN
	ShipToST = DataVals<Label$ShipToST>				;* 2 characters
	IF NOT( ShipToST MATCHES '2A' ) THEN
		ErrorMsg = 'Ship To State Code incorrect ':QUOTE(ShipToST):' should be 2 letters.'
	END
END

IF DataVals<Label$ShipToZIP> NE '' THEN
	ShipToZIP = DataVals<Label$ShipToZIP>				;* 7 alphanumeric
	IF LEN(ShipToZIP) > 7 THEN
		ErrorMsg = 'Ship To ZIP ':QUOTE(ShipToZIP):' exceeds 7 characters.'
	END
END

IF DataVals<Label$CustPartNos> NE '' THEN
	CustPartNos = DataVals<Label$CustPartNos>
	CPNCnt = COUNT(CustPartNos,@VM) + (CustPartNos NE '')
	FOR I = 1 TO CPNCnt
		CustPartNo = CustPartNos<1,I>							;* 18 Alphanumeric
		IF LEN(CustPartNo) > 18 THEN
			ErrorMsg = 'Customer Part Number ':QUOTE(CustPartNo):' exceeds 18 characters.'
		END
	NEXT I
END

IF DataVals<Label$CustPartQtys> NE '' THEN
	CustPartQtys = DataVals<Label$CustPartQtys>
	CPNCnt = COUNT(CustPartQtys,@VM) + (CustPartQtys NE '')
	FOR I = 1 TO CPNCnt
		CustPartQty = CustPartQtys<1,I>							;* 6 numeric
		IF LEN(CustPartQty) > 6 THEN
			ErrorMsg = 'Customer Part Qty ':QUOTE(CustPartQty):' exceeds 6 characters.'
		END
		IF NOT(NUM(CustPartQty)) THEN
			ErrorMsg = 'Customer Part Qty ':QUOTE(CustPartQty):' is not a number.'
		END
	NEXT I
END


