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



Scott and Barbara, and others,

Thanks for the input. I don't know RPG IV well enough to have created the code you have listed. My company will be dumping this great system in the not too distant future - maybe a lot of people as well. I can understand what has been presented in the code samples that have been provided, they make sense, , and they are much appreciated. I have had to use processes like this in my past using COBOL. Hard part is coming up with the language syntax - which really shouldn't have been so difficult - except with only RPG III "experience" the last few years, it isn't as straightforward as it really should have been.

And now, back to the focus of this great forum. I learn a lot that I will likely never be in a position, again, to use - but learning is important.

John McKee

-----Original message-----
From: Scott Klement midrange-l@xxxxxxxxxxxxxxxx
Date: Thu, 04 Aug 2011 14:38:17 -0500
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Character conversion

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


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.