|
sunil K Tripathi wrote: > > Hi all, > > I am trying to extract the packed value from a string what i did is this : > > $HtoC PR extproc('cvthc') > P$TgtChar * > P$SrcHex * > P$TgtBytes 10i 0 value > > $CtoH PR extproc('cvtch') > P$TgtHex 64a options(*varsize) > P$SrcChar 128a const options(*varsize) > P$SrcBytes 10i 0 value > > callp $CtoH(w$hex:%subst(w$FldValue:1:a$Length(i)): > a$length(i)) Sunil, I think you can get MCH0601 from cvtch when the source value contains invalid hex values. C to H assumes you have a value like '123F' that you want to convert to x'123F'. You are starting with the x'123F' form, so I think you want cvthc. (But actually, you probably really want the data structure approach that others have recommended.) By the way, for these functions cvtch and cvthc, I don't know how anyone can remember which of 'A1B2' or x'A1B2' is "hex" and which is "char". But your prototype gives the clue. It has 128 bytes for the source and 64 bytes for the target, implying that it is reducing pairs of characters to a single character.
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.