|
A quick, minor correction: The instruction: padNbr = 16 - len; should have followed the instruction: If (len < 16); Mel Rothman Mel Rothman, Inc. Mel Rothman wrote:
If you are running on V5R3M0, you can use the new %SUBARR built-in function and an array mapped over outTest. Using a similar overlaying technique, you can get rid of the padChars constant.For example: D inTest S 16A inz('ABCDE') D ds D outTest 32A D outTestArr 1A dim(32) overlay(outTest) D padChar 1A D padNbr 3u 0 overlay(padChar) D len s 10I 0 D bigPad C const(x'1010101010101010101010101010- D 1010') /free exsr pad; inTest = 'abcdefghijklmnop'; exsr pad; *inlr = *on; begsr pad; len = %len(%trim(inTest)); outTest = inTest; padNbr = 16 - len; If (len < 16); %subarr(outTestArr: len + 1: 16 - len) = padChar; Else; %subst(outTest: 17: 16) = bigPad; EndIf; endsr; /end-free Mel Rothman Mel Rothman, Inc.
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.