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



Hello,

declare your parm char(4) and use %char(counter) to fill it.

-----Message d'origine-----
De : RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> De la part de Patrik Schindler
Envoyé : mercredi 9 juin 2021 12:00
À : RPG programming on IBM i <rpg400-l@xxxxxxxxxxxxxxxxxx>
Objet : [V4, positional]: Converting decimal to string without leading zeros



ATTENTION : Ce message provient d'une source EXTERNE. Veuillez n'ouvrir les liens ou pièces jointes que si vous êtes sûr de l'expéditeur.



Hello,

I've created a CL program declaring a 4 char string variable. This is passed to an RPGLE program to fill in how many records have been processed. In it's D-specs I declare this as "4S 0", and MOVE a counter variable's contents to there before the program ends. After the RPG program is finished, I'm using SNDPGMMSG with a custom *MSGF to output the number of records processed. (This circuitous way is — to my knowledge — the only way to output a messages which stay in the message line even after the program itself has ended and the command line is appearing again.)

The MOVE creates a string with leading zeros. What would be the easiest/least-code/correct way to get rid of these?

I can't pass the number as number, because the CL compiler complains when the call to SNDPGMMSG is done using *DEC instead of *CHAR.

Thanks for your opinions!

:wq! PoC

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://urldefense.com/v3/__https://lists.midrange.com/mailman/listinfo/rpg400-l__;!!J76aczzK!iESH-_qXzfHFF799zDEIm3t49oDAvezwZpiZ36QkrGgSVInwdG_IIgIore4nkDhJcRUXlQ$
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.com/v3/__https://archive.midrange.com/rpg400-l__;!!J76aczzK!iESH-_qXzfHFF799zDEIm3t49oDAvezwZpiZ36QkrGgSVInwdG_IIgIore4nkDj92JQf7A$ .

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://urldefense.com/v3/__https://amazon.midrange.com__;!!J76aczzK!iESH-_qXzfHFF799zDEIm3t49oDAvezwZpiZ36QkrGgSVInwdG_IIgIore4nkDhzNZtuqw$

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.