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

Negetive numeric value decleration


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Fri Oct 03, 2008 2:04 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts Numeric check on packed signed and un... COBOL Programming 4
No new posts Numeric check w/SyncSort. SYNCSORT 1
Search our Forums:

Back to Top