× 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.



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.

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.