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
 

 

What is the result of the below code?

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

New User


Joined: 27 Mar 2006
Posts: 95
Location: India

PostPosted: Mon Dec 11, 2006 5:18 pm    Post subject: What is the result of the below code?
Reply with quote

01 A PIC S9(3).

MOVE -125 TO A.
DISPLAY A.



What is the value of A?
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 11, 2006 5:28 pm    Post subject:
Reply with quote

12N
will be displayed
Back to top
View user's profile Send private message
rajesh_mbt

New User


Joined: 27 Mar 2006
Posts: 95
Location: India

PostPosted: Mon Dec 11, 2006 5:31 pm    Post subject: Re: What is the result of the below code?
Reply with quote

Thanks for your reply.
Can you help me how it becomes 12N.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 11, 2006 5:38 pm    Post subject:
Reply with quote

The sign will be punched on the least significant bit.
The corresponding codes for the positive and negetive digits are as follows....

if the no. is positive and the ...
last digit is | corresponding value is
1 | A
2 | B
3 | C
4 | D
5 | E
6 | F
7 | G
8 | H
9 | I
RESPECTIVELY

if the no. is negetive and the ...
last digit is | corresponding value is
1 | J
2 | K
3 | L
4 | M
5 | N
6 | O
7 | P
8 | Q
9 | R
Back to top
View user's profile Send private message
karthick Raja

New User


Joined: 10 Aug 2006
Posts: 8

PostPosted: Mon Dec 11, 2006 6:09 pm    Post subject: Re: What is the result of the below code?
Reply with quote

Hi,

Just put HEX ON and you can note the value suppressed. (Lease Significant Bit + Sign).
Back to top
View user's profile Send private message
muthukannan

New User


Joined: 03 Aug 2006
Posts: 42
Location: Chennai

PostPosted: Tue Dec 12, 2006 8:51 am    Post subject: Re: What is the result of the below code?
Reply with quote

Hi,

If we are declaring s9(4) , its displaying the same value. How to display the 123 with a minus symbol or 123N?

Can you please explain about this.

Thank you,
MK icon_smile.gif
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Dec 12, 2006 9:49 am    Post subject: Re: What is the result of the below code?
Reply with quote

Quote:
How to display the 123 with a minus symbol or 123N?

Declare it as PIC ---9.
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 128
Location: kerala,india

PostPosted: Tue Dec 12, 2006 10:48 am    Post subject:
Reply with quote

You can also declare variable as PIC S9(3) SIGN IS LEADING SEPARATE.
Back to top
View user's profile Send private message
h.dinesh

New User


Joined: 06 Dec 2006
Posts: 46
Location: Chennai

PostPosted: Tue Dec 12, 2006 6:30 pm    Post subject: Re: What is the result of the below code?
Reply with quote

Hi,

Just to add to above
PIC S9(4) SIGN LEADING SEPARATE --- displays sign in the beginning

you may also use
PIC S9(4) SIGN TRAILING SEPARATE --- displays sign at end

Dinesh
Back to top
View user's profile Send private message
muthukannan

New User


Joined: 03 Aug 2006
Posts: 42
Location: Chennai

PostPosted: Wed Dec 13, 2006 12:03 pm    Post subject: Re: What is the result of the below code?
Reply with quote

Hi Guys,

Thank you so much for the elaborated explanasions.

Thank you,
MK icon_smile.gif
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 How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm


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