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



Well back in 2000 we didn't have qualified DS and a whole bunch of other stuff.

Some of the changes I made could have been done back then but qualified DS are so nice for this kind of thing.

P.S. There is a good generic example of iconv on the midrange wiki - still fixed format but a more up-to-date approach. See https://wiki.midrange.com/index.php/Iconv_usage

This is the relevant bit - not tested but ...

Dcl-DS Buffy;
BUFFA Char(1) DIM(500000);
End-DS;

Dcl-S BUFLEN Int(10);
Dcl-S MUFFY Char(500000);
Dcl-S MUFLEN Int(10) INZ(500000);

Dcl-DS QtqCode_T Template;
Qtq_CcsId Int(10);
Qtq_CnvAlt Int(10) INZ( 0 );
Qtq_ShfSttAlt Int(10) INZ( 0 );
Qtq_InpLenOpt Int(10) INZ( 0 );
Qtq_ErrOptMxd Int(10) INZ( 0 );
Qtq_Rsv Char(8) INZ( *ALLX'00' );
End-DS;

Dcl-DS fromcode LIKEDS( QtqCode_T ) Inz(*LikeDS);
Dcl-DS tocode LIKEDS( QtqCode_T ) Inz(*LikeDS);

Dcl-S rc Int(10);

fromcode.Qtq_CcsId = 1208; // Values placed directly into DS
tocode.Qtq_CcsId = 37; // no copying of whole DS required

iconv_t = IconvOpen( %Addr( tocode ) : %Addr( fromcode ));

// %Addr used instead of loading pointers. I guess the original problem was that
// BUFFY and MUFFY were being passed in as parms and therefore the address could
// have changed on each call hence resetting them cured the problem.

RC = ICONV(iconv_t: %Addr(BUFFY): BUFLEN: %Addr(MUFFY): MUFLEN);

Jon P.

P.P.S. The PL/I notion would not have washed - nobody would have used it. And IBM would never have funded it. Heck, at that time we were trying to drop the PL/I compiler as hardly anybody used it and it was costing us money to maintain. RPG IV worked because it gave a new foundation while still supporting the "old crap". That foundation has evolved significantly and led to some of the amazing programs we have out there today.


On Jul 11, 2024, at 1:44 PM, James H. H. Lampert via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx> wrote:

On 7/11/24 10:19 AM, Jon Paris wrote:
Glad you got it solved, but you have a lot of old-fashioned and
unnecessary code in there. Are you writing for a really old system?

Old-fashioned, I'll give you. After all, I do spend my Saturdays running (among other antiques) Linotype machines (were you aware that Ottmar Mergenthaler was using binary codes to sort matrices back into the magazine, in an era when a "digital computer" was a guy counting on his fingers?). And I not only *use* (albeit often in very unconventional ways), but *advocate for the use of* The RPG Cycle. And I still think IBM would have done better to just implement an ILE PL/I compiler, than to go to the expense of making RPG accept source that "looks kind of like PL/I."

But what's the "unnecessary" part? My iconv call is based very closely on Carsten Flensburg's example code from 2000. If there's a way to simplify it, I'm all ears.

--
JHHL
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.