Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Replace Sign by '('

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Fri Nov 06, 2009 3:34 pm    Post subject: Replace Sign by '('
Reply with quote

My field is defined as

01 FIELD PIC -,---,--9.99.
01 FIELD-R REDIFINES FIELD PIC X(12).


Some numeric value is moved in FIELD, e.g. -101.75
when displayed it prints as -101.75

What I want to print is (101.75)

I can eazily put ')' as it's position is fix. Problem is with '(' as its position depends upon the size of the number.
We are using '-' for leading zero suppressing. Can i use INSPECT to replace this '-' with '('.



I have tried

INSPECT FIELD RELACING '-' BY '('

INSPECT FIELD-R RELACING '-' BY '(' ......... Nothing is working

Any work around ??
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


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

PostPosted: Fri Nov 06, 2009 4:02 pm    Post subject:
Reply with quote

1) The COBOL code you posted won't compile -- it is REPLACING not RELACING. This is why people are told, repeatedly, to cut and paste the code instead of typing it again -- typos can drastically change the meaning of the posted code.

2) Have you tried INSPECT FIELD-R REPLACING FIRST '-' BY '('. ?
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Fri Nov 06, 2009 4:20 pm    Post subject:
Reply with quote

INSPECT FIELD-R (or FIELD) REPLACING ALL "-" BY "(".

works for me
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Fri Nov 06, 2009 5:20 pm    Post subject:
Reply with quote

donevin wrote:
INSPECT FIELD-R (or FIELD) REPLACING ALL "-" BY "(".

works for me



I have tried LEADING '-' ..not ALL

will check

Thanks
Back to top
View user's profile Send private message
hsk

New User


Joined: 28 Nov 2006
Posts: 69
Location: India

PostPosted: Fri Nov 06, 2009 5:54 pm    Post subject:
Reply with quote

That works ......

Probably the "LEADING" in the command was causing problems


Thanks you guys !!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Fri Nov 06, 2009 6:05 pm    Post subject:
Reply with quote

Since the first character in your field, once substituted, is a space and not a '(' the LEADING won't work. FIRST will work, ALL will work -- but LEADING means leading: if there's another character in the first position instead of the character you're looking for, the INSPECT is done.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Fri Nov 06, 2009 6:25 pm    Post subject:
Reply with quote

First is then the most accurate in terms of syntax and intention in my opinion.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts Replace last name by first name anatol DFSORT/ICETOOL 10 Thu Mar 15, 2018 3:43 pm
No new posts help to replace columns by rows Vikas Maharnawar DFSORT/ICETOOL 8 Tue Mar 06, 2018 3:27 pm
No new posts How to replace the below query? pkmurali DB2 12 Tue Feb 27, 2018 9:51 pm
No new posts Do we have any Modern tools to replac... NajeebKR Compuware & Other Tools 4 Sat Jan 27, 2018 1:22 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us