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: 8165
Location: East Dubuque, Illinois, 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: 8165
Location: East Dubuque, Illinois, 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 Subtract the ZD fields to provide neg... Balaryan DFSORT/ICETOOL 4 Wed Oct 11, 2017 10:51 pm
No new posts display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm
No new posts Hardcoded negative sign value in output scdinesh SYNCSORT 8 Fri Sep 08, 2017 5:28 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm

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