×
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.
I am trying to reply the thread: "One function to Trim and Edit a
number"...
John,
The technique I use to reformat data based on variable types, sizes, and
edit codes uses the two system APIs: Convert Edit Code to Edit Mask and
Edit Value Using Edit Mask:
D convertEditCodeToEditMask...
D PR extpgm('QSYS/QECCVTEC')
D outEditMask 256A options(*varsize)
D outEditMaskLength...
D 10I 0
D outReceiverVariableLength...
D 10I 0
D outZeroBalanceFiller...
D 1A
D inEditCode 1A const
D inFloatFillCharacter...
D 1A const
D inSourcePrecision...
D 10I 0 const
D inSourceDecimals...
D 10I 0 const
D outErrorCode 32767A options(*varsize)
D formatUsingEditMask...
D PR extpgm('QSYS/QECEDT')
D outReceiverVariable...
D 256A options(*varsize)
D inReceiverVariableLength...
D 10I 0 const
D inSourceVariable...
D 256A const
D inSourceClass 10A const
D inSourcePrecision...
D 10I 0 const
D inEditMask 256A const options(*varsize)
D inEditMaskLength...
D 10I 0 const
D inZeroFillCharacter...
D 1A const
D outErrorCode 32767A options(*varsize)
//
=======================================================================
// Function variableZonedEditCode:
//
=======================================================================
// This function returns the result of applying the edit code against
the
// zoned format numeric value of specified precision and decimals.
// Name Description Use Size Type
Required
// ------------- ----------------------- --- ----- ----
--------
// 1) zonedValueAddress... I 16 *
Yes
// %addr of packed numeric value to format
// 2) precision I 10,0 I
Yes
// %len of zoned numeric value
// 3) decimals I 10,0 I
Yes
// %decpos of zoned numeric value
// 4) editCode I 1 A
Yes
// Edit code used to format zoned numeric value.
// Valid values are: 'A'-'D', 'J'-'Q', 'W', 'Y'-'Z', and '1'-'9'.
// 5) floatFiller I 1 A
Yes
// How to pad the left side of the formatting.
// ' ' (*blank) = Suppressed zeroes are blank-filled.
// '*' = Suppressed zeroes are asterisk-filled.
// x'41'-x'FE' = Currency symbol to be placed to left of first
digit.
//
=======================================================================
// Returns:
// Description Size
Type
// -------------------------------------------------------- -----
----
// Varying length of result of formatting 256
A
//
=======================================================================
P variableZonedEditCode...
P B
D PI 256A varying
D zonedValueAddress...
D * const
D precision 10I 0 const
D decimals 10I 0 const
D editCode 1A const
D floatFiller 1A const
D errorFound N options(*omit)
//
=======================================================================
// - Local Variables -
//
=======================================================================
D value S 256A based(zonedValueAddress)
D editMask S 256A inz
D editMaskLen S 10I 0 inz
D receiverLen S 10I 0 inz
D zeroFiller S 1A inz
D receiverVariable...
D S 256A inz
D wkEditCode S 1A inz
/free
if editCode = 'X';
wkEditCode = 'L';
else;
wkEditCode = editCode;
endif;
return %subst(receiverVariable : 1 : receiverLen);
/end-free
P E
Kind regards,
Michael P. Scott
Programmer Analyst II
Merch-Setup Engineer Liaison
Merchandise Setup (formerly known as Merch Anc 1)
Information Systems
mscottx@xxxxxxxxxx
425-427-7887
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.