Hi John,

On 8/4/2011 12:52 PM, John McKee wrote:
In the event that the two digits were 7 and 8, in a character string, the hex values (zoned) would be F7F8. Goal is to convert zoned to unsigned packed, so F7F8 converts to 78 not 4E.

I believe I messed up earlier in terminology.


The cvtch() example that I posted earlier should do this nicely.

H DFTACTGRP(*NO) BNDDIR('QC2LE')

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

D InputData ds qualified
D zonedVal 2s 0

D result s 1a

/free
InputData.zonedVal = 78;
cvtch( result: inputData: %size(inputData) );
// result = x'78'.

If you need to handle numerics longer than 2 long (this seems likely) you could simply make 'zonedVal' larger.

Barbara Morris's example will work as well (using an alternative method of conversion) as well.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2026 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.