Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Convert a negative value into positive value

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

New User


Joined: 21 Jun 2005
Posts: 5

PostPosted: Tue Nov 29, 2005 4:36 pm    Post subject: Convert a negative value into positive value
Reply with quote

Hi , I want to convert a negative value into positive value . Is there any intrinsic function available. do we have -- as valid operator in cobol
Back to top
View user's profile Send private message

DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Wed Nov 30, 2005 5:23 am    Post subject: Re: Absolute function in cobol (convert a -ve value into +ve
Reply with quote

ys_more,

Not that I know of, and the coding to do it in cobol is pretty complex.
Code:

IF VE < 0
THEN
    MULTIPLY VE BY -1
END-IF.
icon_smile.gif
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Dec 02, 2005 8:26 am    Post subject:
Reply with quote

I assume your field is part of a file rec that you're reading into your pgm.

I haven't done this in a while, but you can define the field as unsigned, then move it to itself. That strips the sign.
Code:

01  rec1.
     .
     .
     .
    05  var1  pic 9(004).
     .
     .

move var1 to var1
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 Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Convert current to hex value gopurs DFSORT/ICETOOL 4 Wed Feb 15, 2017 5:40 am
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us