Programming Languages COBOL Subjective
Mar 15, 2013

How to remove the spaces at the end of each record in the output file of variable length, via COBOL program?

Detailed Explanation

Spaces at the end of the record are called trailing spaces. There are no functions to trim the trailing space. It can be done by altering the RECORD-LENGTH. The following is the accomplish this task
- Assuming that a variable length file has maximum record length as 4000
- Move the original record length value to RECORD-LENGTH. This process enables the trimming off the entire record that is beyond the length.
- In case the data is populated only up to 3000 bytes. Then move 3000 to RECORD-LENGTH.
- By implementing the above process, the record would trim off the trailing 1000 bytes.

Discussion (0)

No comments yet. Be the first to share your thoughts!

Share Your Thoughts
Feedback