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
 
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: 6968
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 File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm

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