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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to transform a line break into a character?

Status
Not open for further replies.

guirone

Programmer
Apr 1, 2011
8
0
0
CH
Good morning all,

I've the following problem:
My cobol retrieve a field from a table and value of this field is a text note that could contain line breaks.

I need to remove the line breaks from the retrieved value and change it into a character value as "-".

I tried doing the following:

INSPECT WS-TEXT REPLACING ALL X"15" BY "-" or
INSPECT WS-TEXT REPLACING ALL X"7B" BY "-"

but in both cases it doesn't work.Debugging this line no changes are applied to WS-TEXT.

Does anyone know which is the element corresponding with line break(X"7B" or X??) and if inspect command can be used?

Thanks and I hope you can help me.

 
What COBOL and what platform, and how are you opening the file?

It is not possible for anyone to acknowledge truth when their salary depends on them not doing it.
 
the COBOL is my program while platform is Personal Communications 5.9 for windows.
file is a table where information is stored with break line.
 
What about this ?
INSPECT WS-TEXT REPLACING ALL X"0A" BY "-" or
INSPECT WS-TEXT REPLACING ALL X"0D" BY "-"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
I just tested both suggestions but unfortunately they doesn't works.
 
file is a table where information is stored with break line
So, have a look at an hexa dump of this file to discover the "line break" character.

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks for you help!

I found that character in question is X"25" of EBCDIC.

Do you know if inspect command slow the perfomance of a program?
 
COBOL is vendor and version; e.g. Micro Focus Visual COBOL 3.6
Mentioning EBCDIC was also helpful
Platform is O/S and version; e.g. Windows 7 sp 2
 
So, the following should do the needed replacement:
Code:
INSPECT WS-TEXT REPLACING ALL X"25" BY "-"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top