Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scan and replace leading zeros

Status
Not open for further replies.

jmd0252

Programmer
May 15, 2003
667
OK guys I am not very good on string manipulations. I am moving an 8 byte numeric fiels to an 8 byte character, and need to replace only the leading zeros. Leading zeros, and not always the same length,, could be from 2 to 4. And I need to shift it to the left also,, to left justify the field. Need to do it on the AS400, so I can DTS it into Sql Table. Ideas?????



 
In RPG,

Code:
        charfield = %trim(%editc(numericfield:'L'));

should do it. If the value of the numeric field is zero, this will make the character field '0'.

Use whatever edit code you require.

Solum potestis prohibere ignes silvarum.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top