COBOL Move



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

Re: COBOL Move

Postby NicC » Wed Mar 12, 2014 4:49 pm

You seem to have no decimals in your field definitions so how come you are showing them? what does the field show when you DISPLAY it? 0000000580930720?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: COBOL Move

Postby maragatham pp » Wed Mar 12, 2014 4:57 pm

The Input field is declared as MBS-AMORTN-VAL PIC 9(0012)V9(04)
maragatham pp
 
Posts: 19
Joined: Fri May 20, 2011 12:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL Move

Postby dick scherrer » Wed Mar 12, 2014 10:24 pm

Hello,

Yup, a pic of anythingvsomenumber has no decimal . . . It is implied and will be scaled properly when computations are done, but it will not be seen when displayed.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: COBOL Move

Postby BillyBoyo » Thu Mar 13, 2014 5:42 am

The thing is, you have shown your output field defined with no decimal places, and then tell us that it has a large number of decimal places.

Can you show some representative values for your input, and the expected output you get for them, including whether the decimal places are implied, with the V, or explicit.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: COBOL Move

Postby Quasar » Thu Mar 13, 2014 7:24 am

In addition to the comments above - you mention POSOUT-AMORTN-RATE is S9(14) COMP, the field has no decimal(fractional) places. Like Billy says, could you show some representative values for your input and the expected output values.
Quasar Chunawala,
Software Engineer, Lives at Borivali, Mumbai
User avatar
Quasar
 
Posts: 102
Joined: Wed Nov 10, 2010 7:11 pm
Location: Borivali, Mumbai
Has thanked: 13 times
Been thanked: 2 times

Re: COBOL Move

Postby maragatham pp » Thu Mar 13, 2014 12:29 pm

Input field is MBS-AMORTN-VAL PIC 9(0012)V9(04)
Output Field is WW-NR-RATE PIC S9(14)

Input Data 58093.0720
When Displayed - 0000000580930720
Output Data Expected 58093
Displayed as - 0000000058093{
maragatham pp
 
Posts: 19
Joined: Fri May 20, 2011 12:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL Move

Postby BillyBoyo » Thu Mar 13, 2014 1:10 pm

OK, thanks for that example. Can you give more examples, which test your range of valid data. At the moment it looks like a number with seven decimal places which you want to treat as three decimal places. Does that describe what you are trying to do? If not, what does?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: COBOL Move

Postby maragatham pp » Thu Mar 13, 2014 2:22 pm

Hi, Below are the changes I did to intermediate variable declarations and their corresponding output.

01 WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(12)V9(4).
01 WS-MBS-ALIGNED-NO-DECS-R
REDEFINES WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(16).


Input 0000000580930720
Output 0000058093072{


01 WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(9)V9(3).
01 WS-MBS-ALIGNED-NO-DECS-R
REDEFINES WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(12).

Input 0000000580930720
Output 0000005809307B


01 WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(8)V9(4).
01 WS-MBS-ALIGNED-NO-DECS-R
REDEFINES WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(12).

Input 0000000580930720
Output 0000058093072{


01 WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(8)V9(4).
01 WS-MBS-ALIGNED-NO-DECS-R
REDEFINES WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(8).


Input 0000000580930720
Output 0000000005809C

01 WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(12)V9(4).
01 WS-MBS-ALIGNED-NO-DECS-R
REDEFINES WS-MBS-VAL-TRUNC-L-EXTEND-R PIC 9(12).

Input 0000000580930720
Output 0000000005809C
maragatham pp
 
Posts: 19
Joined: Fri May 20, 2011 12:44 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COBOL Move

Postby NicC » Thu Mar 13, 2014 5:14 pm

And what were you hoping to see for these values? At the moment you are getting the expected results for the definitions shown. Are you hoping to get 1234 if you put in 1234.5678 or are you hoping to get 12345678?
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: COBOL Move

Postby maragatham pp » Thu Mar 13, 2014 5:39 pm

I expect 1234.
maragatham pp
 
Posts: 19
Joined: Fri May 20, 2011 12:44 pm
Has thanked: 0 time
Been thanked: 0 time

PreviousNext

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post