PIC S9(9)V99 COMP-3



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

PIC S9(9)V99 COMP-3

Postby Sivaji » Tue Dec 20, 2011 12:46 pm

Hi,
My copybook field has PIC S9(9)V99 COMP-3. i want to final output to be dislayed like -3136488.00(+ or - should also be displayed). Can someone help with standard format to achieve the same.
Sivaji
 
Posts: 8
Joined: Thu Dec 15, 2011 3:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: PIC S9(9)V99 COMP-3

 

Re: COMP-3

Postby NicC » Tue Dec 20, 2011 1:53 pm

Have you looked in the manual for picture editing symbols?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: COMP-3

Postby Sivaji » Tue Dec 20, 2011 2:18 pm

Is it a standard format to move it to a pic 999999999.99 field and display the value..I just want to know the proper comp-3 move to obtain my result..
Sivaji
 
Posts: 8
Joined: Thu Dec 15, 2011 3:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COMP-3

Postby NicC » Tue Dec 20, 2011 2:31 pm

How else do you think it would be done?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: COMP-3

Postby BillyBoyo » Tue Dec 20, 2011 2:35 pm

Well, NicC has given you very good advice. If you want to do it with the 9's like you have, just don't forget to put a leading/trailing sign on (+ or -, experiment). Also see the effect of ZZZZZZZZ9.99- with smaller numbers.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: COMP-3

Postby Sivaji » Tue Dec 20, 2011 2:47 pm

Yeah i know to use the z(9).99-. for this move but i doubt whether it could be the standard format to be used in COBOL. So i asked for various other methods to achieve the same..
Thanks..
Sivaji
 
Posts: 8
Joined: Thu Dec 15, 2011 3:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COMP-3

Postby BillyBoyo » Tue Dec 20, 2011 2:55 pm

There is no reall "standard" format. How you format the numbers depends on the requirement. I should think for reporting I've used the Zs about 95% of the time. Other than files going to external systems I've not put physical decimal points in files. For files going to external systems, either the Zs (for CSVs) or 9s (for fixed-format files).
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

Re: COMP-3

Postby Sivaji » Tue Dec 20, 2011 3:01 pm

Thank you all guys..
Sivaji
 
Posts: 8
Joined: Thu Dec 15, 2011 3:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COMP-3

Postby Sivaji » Tue Dec 20, 2011 3:31 pm

As i want the sign value to be in front i gave it as -Z(9).99. But the thing is that i am getting the values in this format
- 7168.00(spaces after sign field). Which actually i want it as -7168.00.How can i eliminate the spaces after the sign.
Sivaji
 
Posts: 8
Joined: Thu Dec 15, 2011 3:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COMP-3

Postby BillyBoyo » Tue Dec 20, 2011 3:56 pm

Replace the Zs by -s, this will cause the - to "float" and it is also going to suppress the leading zeros.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post