View previous topic :: View next topic
|
Author |
Message |
raviprabhu
New User
Joined: 20 Oct 2006 Posts: 29
|
|
|
|
Hi,
I am having a file having variable length records and last byte of all records have one ',' which i want to make it 'Space'
For e.g:
rec 1: AQAAAAAA,Ashhsjk,jndfklsj,
rec 2: ahd,jsjk,djksljf,
The last byte of records are having ',' which i want to blank.
Let me know if its possible by any verb like string, inspect etc. or best possible method |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
It is not possible to do this with a single COBOL statement. However, with multiple COBOL statements it is easy. Use FUNCTION REVERSE to reverse the variable. Use INSPECT TALLYING LEADING SPACES to count the blanks until the first non-blank character. If the first non-blank character is a comma, use reference modification to change it. Use FUNCTION REVERSE to restore the variable. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If you use RECORD IS VARYING ... DEPENDING ON ... for your file, your depending-on value will indicate the length of the data.
You could then use that value as a subscript, or for the obfuscating reference-modification. |
|
Back to top |
|
|
|