IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Inspecting \N


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Oct 29, 2009 3:55 pm
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Oct 29, 2009 4:27 pm
Reply with 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.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Oct 29, 2009 5:32 pm
Reply with quote

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... icon_razz.gif
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Oct 29, 2009 5:41 pm
Reply with quote

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
Code:
ABC\NXYZ
ABC$$XYZ


Is this what you have tried ?? or something else ?? icon_cool.gif
Please explain...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Oct 29, 2009 5:48 pm
Reply with quote

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
View user's profile Send private message
tomehta

New User


Joined: 18 Aug 2008
Posts: 98
Location: India

PostPosted: Thu Oct 29, 2009 5:57 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Inspecting a record for all alphabets COBOL Programming 6
No new posts Inspecting a phrase and replacing COBOL Programming 3
Search our Forums:

Back to Top