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
 

 

need some help on signed declaration in pl/1

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
kiran_65

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Fri Aug 14, 2009 3:07 pm    Post subject: need some help on signed declaration in pl/1
Reply with quote

Hi,

I have a file.

One of the feild in the file is having picture clause EMPLE_DED_AMT PIC '(7)9V99' and the value is 00000023J.

I am adding all the amounts of the feild. But while adding it is not subtracting while it is adding (means if the previous valueis 20.34 and adding t0 23J should give 18.03 where it is giving 22.65.)

The declaration of the adding feild to EMPLE_DED_AMT is EMPL_DEDUCT_TOTAL FIXED DECIMAL(13,2) INIT(0);

Note: I am seeing as INVALID in the file aid when trying to view the value.

Please help me in declaring the feilds.

Thanks,
Kiran
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Fri Aug 14, 2009 5:11 pm    Post subject:
Reply with quote

Where's the sign? If your value is +2.30 and you add it to 20.34 you're not going to get 18.03. You need the value to be -2.30 for that arithmetic to work.
Back to top
View user's profile Send private message
kiran_65

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Fri Aug 14, 2009 11:38 pm    Post subject: Reply to: need some help on signed declaration in pl/1
Reply with quote

Thanks for the reply. I am new to PL/I. So, can you please provide the declaration of how we can declare PIC '(7)9v99 and corresponding fixed binary or fixed decimal.

Thanks,
Kiran
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7932
Location: Bellevue, IA

PostPosted: Fri Aug 14, 2009 11:59 pm    Post subject:
Reply with quote

It's been a while since I did any PL/I code but I believe an S in the PIC defines the sign.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 989
Location: Oostende, Belgium

PostPosted: Sat Aug 15, 2009 2:13 pm    Post subject: Re: Reply to: need some help on signed declaration in pl/1
Reply with quote

kiran_65 wrote:
Thanks for the reply. I am new to PL/I. So, can you please provide the declaration of how we can declare PIC '(7)9v99 and corresponding fixed binary or fixed decimal.


Code:
FIXED DEC (9,2)


Don't even think about a corresponding FIXED BIN, as these should never ever be used for anything other than integer values.

To make your PIC signed, it must be declared as
Code:
PIC 'S(7)9v99'

or
Code:
PIC '(7)9v99S'

or
Code:
PIC '(7)9v9?'
where '?' is one of the overpunch characters, which I've never used, aka RTFM.
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 -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SIGNED DECIMAL TO COMP-3 using cobol ... ram_vizag COBOL Programming 1 Tue Mar 01, 2016 11:32 pm
No new posts Declaration of varchar in cobol s.saranya srinivasan COBOL Programming 6 Fri Sep 25, 2015 11:43 am
No new posts COBOL File Declaration for RECFM=VBS ... thinkmsk COBOL Programming 4 Fri Apr 03, 2015 3:31 pm
No new posts How to convert unsigned numeric to si... mftechie123 SYNCSORT 7 Thu Jan 29, 2015 4:54 pm
No new posts Issue in Comparing 2 Signed Comp Vari... elango Paulraj COBOL Programming 4 Thu Jan 08, 2015 1:55 pm


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