using cvthc? and you get the expected result?
Also, you can always hard code a max length and decimal position value on
%dec that will cover all possible different combination of len and decpos.
Such as
myDec = %dec(myString :64 :30). Now if your data actually exceed this big
number, then we are talking about some serious money here. In that case,
I'll just be quite.... ;).
<Rick.Chevalier@xxxxxxxxxxxxxxx> wrote in message
news:mailman.30961.1298579704.2702.rpg400-l@xxxxxxxxxxxx...
Sorry, I wasn't clear. It is a character representation of a packed field.
The source value is a character field that looks like x'12345F'. The length
could vary as well as the decimal places. I am 'unpacking' it into a
character field that will have '12345'.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of hockchai Lim
Sent: Thursday, February 24, 2011 2:11 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: cvthc not converting all values
When you say "I am unpacking a packed field into a character string.", is
that means that you have a packed decimal field and you call the cvthc to
change that packed field into character string? if so, why not just use
%char or %editc?
<Rick.Chevalier@xxxxxxxxxxxxxxx> wrote in message
news:mailman.30934.1298574735.2702.rpg400-l@xxxxxxxxxxxx...
No, it's the right one. %Dec won't work because I can't use variables for
the length and decimals. I am unpacking a packed field into a character
string. The definition of the field is passed with the value.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of hockchai Lim
Sent: Thursday, February 24, 2011 10:18 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: cvthc not converting all values
could you have mis-understood what this api does. cvthc is intended to
convert a char string into a hex representation of the char string. So if
you have a char string containing value of 'TEST, it produces the result of
'E3C5E2E3'.
Also, your prototype for cvthc is not correct. May be scott's article would
help understanding more about this api:
http://systeminetwork.com/article/convert-data-and-hexidecimal.
For what you want to do (if I understand you correctly), all you need is
%char or %editc.
<Rick.Chevalier@xxxxxxxxxxxxxxx> wrote in message
news:mailman.30867.1298562517.2702.rpg400-l@xxxxxxxxxxxx...
I have been reading the archives and looking at the MI Reference manual but
I just can't figure out what I'm doing wrong. I am trying to convert a
5-digit packed value into a character value. cvthc is only converting the
first byte. My test value is 12345F and my results are 12, only the first
byte. The manual shows an example where it is converting a 9-byte value to
character with one call. I have verified that the length I am passing is 5.
I also tried 6. Any thoughts on what I'm doing wrong?
This is the prototype:
d HexToChar pr ExtProc('cvthc')
d Receiver * Value
d Source * Value
d Length 10u 0
This is the function call:
HexToChar(%Addr(ReplaceString)
:NameValuePairs.dsNameValue(Ctr).Value
:NameValuePairs.dsNameValue(Ctr).ValueByteLength);
Definitions:
d ReplaceString s 64a
d dsNamesValues...
d ds Qualified Based(Dummy)
d NumberOfValues...
d 5u 0
d dsNameValue LikeDS(dsNameValue_t) Dim(1000)
d dsNameValue_t ds Qualified Based(Dummy)
d Name 32a
d DataType 3u 0
d NumericLength 3u 0
d Decimals 3u 0
d DTZFormat 3u 0
d DTSeparator 1a
d ValueByteLength...
d 10u 0
d MaxValueByteLength...
d 10u 0
d Value *
Rick Chevalier
IT Software Solutions - Loan Servicing
GM Financial/AmeriCredit
817-525-7178 (w)
________________________________
Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail. You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.
--
This is the RPG programming on the IBM i / System i (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.
Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail. You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.
--
This is the RPG programming on the IBM i / System i (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.
Privileged and Confidential. This e-mail, and any attachments there to, is
intended only for use by the addressee(s) named herein and may contain
privileged or confidential information. If you have received this e-mail in
error, please notify me immediately by a return e-mail and delete this
e-mail. You are hereby notified that any dissemination, distribution or
copying of this e-mail and/or any attachments thereto, is strictly
prohibited.
As an Amazon Associate we earn from qualifying purchases.