Yes, I'm familiar with Code128. But the software that I use generates the proper barcode data for me... and the DDS BARCODE keyword uses a special table for Code-128 barcodes, which differ from the byte values assigned by the Code128 standard.

So the problem with what I coded is that your input data is variable, so hard-coding a value in an expression won't work, right?

One solution would be to do something like this:

myString = Chr$(105) + Chr$(56) + Chr$(78) + Chr$(90)
+ Chr$(104) + Chr$(31) + Chr$(xx);

.
.

P Chr$ B
D PI 1a
D val 3u 0 value
D p_val s * inz(%addr(val))
D result s 1a based(p_val)
c return result
P E

(This code is untested, and off the top of my head -- but should be fairly close to being correct)

That, essentially, gives you the same thing that BASIC has. (Though, in all honesty, I don't think I'd call it Chr$ in actual production code... I'd come up with a better name.)

You can pass variables to it...

SomeVariable = 105;
myString = Chr$(SomeVariable);

Another possibility is to use the cvtch() API.

D cvtch PR ExtProc('cvtch')
D target 32767A options(*varsize)
D src_chars 65534A options(*varsize) const
D src_length 10I 0 value

Though, the input to cvtch() has to be hex, not decimal... but it can be a variable.

myString = *blanks;
inputVar = x'69567890';
cvtch( myString: inputVar: %len(%trimr(inputVar));


On 8/3/2011 5:47 PM, John McKee wrote:
Code 128 has three variants. Set c uses numeric only, packed two digits per byte. Set B uses one character per byte.

Given a seven digit account number, such as 5678901, the output needs to be - decimal values here:

105, 56, 78, 90, 104, 31, xx

I can't recall the specific value for 31, or the check character for xx.

Only constants are 105 and 104. All values are one comma separated number (decimal above) per byte.

I thought this would be easier. I went from a bar code with an incorrect value to no bar code at all.

I need to think about this more. I would have responded earlier, except TWICE, my composed response got trashed, TWICE, by a timed out connection and a mysteriously down (multiple times) webmail server.

Sorry to take up time with this stupid issue.

John McKee
-----Original message-----
From: Scott Klement midrange-l@xxxxxxxxxxxxxxxx
Date: Wed, 03 Aug 2011 16:03:25 -0500
To: Midrange Systems Technical Discussion midrange-l@xxxxxxxxxxxx
Subject: Re: Character conversion

Sorry, I don't follow you. What do you mean by "get 105 in a single
character"? (Unless you mean exactly what I said already, that you
want to set the value of a byte to x'69', which is the same as decimal 105?)

Likewise, when you say F1F2 compressed into 12, that's what I already
said... instead of charvar = '12' you'd do charvar = x'12'.

Isn't that what I said? What am I missing?


On 8/3/2011 3:52 PM, John McKee wrote:
Scott,

That was example data only. Not good, either, unfortunately. I need
to get 105 in a single character. Then, pairs of digits - such as 1
and 2 - which would be in a character string as F1F2 (two characters)
compressed into one character (12). Different digit pairs are needed
(variable data). The 105 and another value, 104, are constants used
to identify the change of coding within a barcode sequence. Just
latched onto %char, unfortunately.

John McKee

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.