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
 

 

Negetive numeric value decleration

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

New User


Joined: 04 May 2008
Posts: 15
Location: india

PostPosted: Fri Oct 03, 2008 1:49 pm    Post subject: Negetive numeric value decleration
Reply with quote

I need to read values from input file (can be both positive and negetive) and add them and write the sum in output file.The sum can be negetive. Kindly help me with the declerations of the following variables so that I can get negetive values also as output.

1. Variable to read the input value
2.Variable to hold the sum
3.Variable which will write in the output file.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6967
Location: porcelain throne

PostPosted: Fri Oct 03, 2008 2:04 pm    Post subject:
Reply with quote

use numeric PIC clause that incorporates a sign,
based on the format of the input field and the output field.

usually, one picks a format that is common to both input and output.
if the output field format is different than the input, I would sum with a variable declared the same as the output.

but, first step is determine the format of the input field and the output field,
then employ the usage clause that fits the format(s).

display, binary, packed-decimal - or float if it must be, with or without implied decimal (V), with appropriate sign separate, trailing clause if it is usage display.

Manuals at top of the page for COBOL will provide documentation
for the proper syntax for each of the different clauses.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Fri Oct 03, 2008 6:31 pm    Post subject:
Reply with quote

Please post what you have tried and where you are stuck?
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


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