×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
I have a program that runs over this proc for quick verifications but it
has extra copy book ties that would make it cumbersome to supply to you.
Screen print:
UPC: -11110-82987
check digit: 0
Code:
P*--------------------------------------------------
P* Procedure name: CalcUPCChkD
P* Purpose: Calculate the UPC check digit
P* Returns: Check digit
P* Parameter: UPC
P* Description: This calculation was pulled from
P* from a document labeled SIL2000.PDF. Its the
P* UCS Standard Interchange Language reference.
P* The algorithm is located in Appendix B.
P*--------------------------------------------------
P CalcUPCChkD B EXPORT
D CalcUPCChkD PI 1P 0
D UPC 15P 0
D* Local fields
D CheckDigit S 1P 0
D Step1Val S 5P 0
D Step2Val S 5P 0
D Step3Val S 5P 0
D Step4Val S 5P 0
D DS
D UPCField 15S 0
D UPCAr 1S 0 DIM(15) Overlay(UPCField)
/FREE
// Array Elm: 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
// Positions: 15 14 13 12 11 10 09 08 07 06 05 04 03 02 01
// 0 0 0 0 5 1 0 0 0 0 0 0 1 1 ? <-
Check Digit
UPCField = UPC*10; // move to left by one
// Starting from position 2 of the number, add up the
// values in the even numbered positions.
Step1Val = UPCar(14) +UPCar(12) +UPCar(10) +UPCar(08)
+UPCar(06) +UPCar(04) +UPCAr(02);
Step2Val = Step1Val * 3;
// Starting from position 3 of the number, add up the values
// in the odd numbered positions. That is, add up all the
// numbers left over from step 1. You're skipping position 1
// because position 1 is the check digit.
Step3Val = UPCar(13) +UPCar(11) +UPCar(09) +UPCar(07)
+UPCar(05) +UPCar(03) +UPCar(01);
Step4Val = Step2Val + Step3Val;
Monitor;
CheckDigit = 10 - %Rem(Step4Val:10);
On-error *All;
CheckDigit = 0;
EndMon;
RETURN CheckDigit;
/END-FREE
P CalcUPCChkD E
Thanks, Matt
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Crosby
Sent: Wednesday, March 28, 2012 2:57 PM
To: RPG programming on the IBM i / System i
Subject: RPG routine for GTIN
All,
Anyone have available (or know of someone who does) RPG routines to
calculate and/or verify the check digit in a GTIN?
I see the RPG xTools has it for $495, along with a lot of other stuff I
don't really need.
Thanks.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.