Remove Trailing & Leading Spaces in COBOL/400

535 pts.
Tags:
AS/400
COBOL 400
Hi Group, How do we remove Trailing & leading spaces from a field in cobol/400? Please explain with an example Thanks & Regards, M

Answer Wiki

Thanks. We'll let you know when a new response is added.

V5R4M0 or higher use Function TRIML, TRIMR or even TRIM.

MOVE FUNCTION TRIM(STREET-ADDRESS,” “) TO STREET-ADDRESS-OUT.

Prior to V5R4 you will have to use the basic INSPECT statement. 

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    But note that the 'Answer' does not result in trailing spaces being removed from STREET-ADDRESS-OUT unless STREET-ADDRESS-OUT is less than or equal to the length of the trimmed value. The value of FUNCTION TRIM(STREET-ADDRESS,” “) is trimmed. Once that value is MOVEd into a field, blanks will be added at the end to fill the result. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following