View previous topic :: View next topic
|
Author |
Message |
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
hello
I am trying to INSPECT a string for \N. But its not working. Do I need to give some escape character for \. I tried searching in the cobol manual, has-nt come across the escape charcater.
I am getting a input string from c++ and \N is a new line character for them.
regards |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
I uses \\N for INSPECT, and it worked. When we are using \\N, cobol is looking for \N, i guess \ is the escape charcter...
please correct me if I am wrong. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Mehta,
Could you give us the example of what you have tried.
Up until now i was not aware of any escape characters in COBOL except for Quotation Marks... |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi,
A sample that I tried now...
Code: |
MOVE 'ABC\NXYZ' TO WS-WORK1
DISPLAY WS-WORK1
INSPECT WS-WORK1 REPLACING ALL '\N' BY '$$'
DISPLAY WS-WORK1 |
Output
Is this what you have tried ?? or something else ??
Please explain... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
I uses \\N for INSPECT, and it worked. When we are using \\N, cobol is looking for \N, i guess \ is the escape charcter...
please correct me if I am wrong. |
I did a test of INSPECT finding '\N' and it returned the correct count. COBOL does not have an escape character -- if you look in the COBOL Language Reference glossary (manuals link at the top of the page), the term is not defined even. |
|
Back to top |
|
|
tomehta
New User
Joined: 18 Aug 2008 Posts: 98 Location: India
|
|
|
|
Code: |
MOVE LENGTH OF WS-SRCH-STRING TO WS-SRCH-STRING-
INSPECT WS-SRCH-STRING TALLYING WS-SRCH-TAG-B-L FOR
CHARACTERS BEFORE INITIAL 'STMTEND\N#X#'
00000455 MC-02/08 INVALID PARAMETER ->N#<- |
This is when I tried with \N .. the code was not able to compiled.
Wehn i used \\N it went fine.
my shop is using a DLETA precompiler, i am sure the error is from delta precompiler and not from the cobol compiler. |
|
Back to top |
|
|
|