Is the scanner emulating a keyboard? Are you reading a serial port?
Is the data corrupt in the 255A field? I assume you are reading that on a
terminal someplace. If not, where is this field (web page, PC program,
what)?
Mike Krebs
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Brian Piotrowski
Sent: Friday, September 28, 2007 1:26 PM
To: RPG programming on the AS400 / iSeries
Subject: 2d Barcode Scan Results - Questions
Hi All,
I'm in the middle of writing some programs that use the data from a 2d
barcode scan and push it do an SQL database. However, I'm encountering some
problems with the scan and I'm wondering I need to do something special to
code it to read properly?
I wrote a really quick program that simply takes the scan and writes it to a
table. If I use my program to scan, the scanner will read garbled data and
write it to the table. However, if I use the scan test program built into
the terminal and scan the exact same 2d barcode, the data is represented
properly.
The data is being written to a 255A field and ultimately to a
varchar(255) field in the database. However, the data is corrupt even
before it hits the db. The labels are of QR type (Japan labels) and are
being read from an Intermec CK-31 scanner.
Anyone have any ideas on what to check? I'll post me code to see if there's
anything obvious that I'm missing.
Thanks!
/b;
Code to follow
RPGLE:
A****************************************************************
A* *
A* PROGRAM ID : SCAN2DR *
A* DESCRIPTION : Scan a 2d Barcode *
A* PURPOSE : When a 2d barcode is scanned, the system will*
A* write the data to CAP2DBC. *
A* *
A* PROGRAMMED BY : B. Piotrowski DATE : 09/28/2007 *
A****************************************************************
A* SUMMARY OF CHANGES *
A****************************************************************
A* DATE PROGRAMMER COMMENTS *
A*--------------------------------------------------------------*
A* 09/28/2007 B. Piotrowski Initial Release *
A****************************************************************
FSCAN2DD CF E Workstn
F IndDS(WkStnIndics)
D WkStnIndics DS
D Exit 3 3N
D
D
D*
D SQLstmt S 1000A INZ varying
D Plantcode S 1A Inz
D USRMESSAGE S 25A Inz
C*
C*
/free
DoW not Exit;
ExFmt prompt_fmt;
if exit;
leave;
ENDIF;
if serialno = '';
USRMESSAGE = 'Please Scan a 2d Barcode!';
serialno ='';
else;
EXSR Write2DBCInfo;
endif;
EndDo;
*InLR = *on;
// Subroutines
BegSR *InzSR;
USRMESSAGE = ' PLEASE SCAN A 2D BARCODE';
serialno = '';
EndSR;
BegSR Write2DBCInfo;
/end-free
c/exec SQL
c+ insert into CAP2DBC VALUES (:serialno)
c/end-exec
C*
/free
IF SQLCOD = 0;
USRMESSAGE = ' Data Written!';
//serialno = '';
else;
USRMESSAGE = ' Data Error!';
serialno = '';
endif;
EndSR;
/end-free
DDS:
A****************************************************************
A* *
A* PROGRAM ID : SCAN2DD *
A* DESCRIPTION : Scan a 2d Barcode *
A* *
A* PROGRAMMED BY : B. Piotrowski DATE : 09/28/2007 *
A****************************************************************
A* SUMMARY OF CHANGES *
A****************************************************************
A* DATE PROGRAMMER COMMENTS *
A*--------------------------------------------------------------*
A* 09/28/2007 B. Piotrowski Initial Release *
A****************************************************************
A CA03(03 'MENU')
A INDARA
A** PROMPT SCREEN
A R PROMPT_FMT OVERLAY
A 1 3' 2D BARCODE ID '
A DSPATR(HI RI)
A USRMESSAGE 25A 2 1
A DSPATR(HI RI)
A 3 1'2D Barcode #:'
A 4 5'F3 = CANCEL'
A SERIALNO 255A B 5 1CHECK(ER) DSPATR(UL)
A*
-=-=-=-=-=-=-=-=-=-=-=-=-=-
Brian Piotrowski
Assistant Mgr. - I.T.
Simcoe Parts Service, Inc.
Ph: 705-435-7814 x343
Fx: 705-435-6746
-=-=-=-=-=-=-=-=-=-=-=-=-=-
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or
change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.