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

need some help on signed declaration in pl/1


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Aug 14, 2009 5:11 pm
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Aug 14, 2009 11:59 pm
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

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Sat Aug 15, 2009 2:13 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Numeric check on packed signed and un... COBOL Programming 4
No new posts Signed Count in Trailer SYNCSORT 7
No new posts Cobol redefines for Signed pictured c... COBOL Programming 4
No new posts Display Signed ZD field DFSORT/ICETOOL 11
Search our Forums:

Back to Top