View previous topic :: View next topic
|
Author |
Message |
leo_sangha
New User
Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
Hi ,
INPUT file :
01 WS-VAR-A PIC s9(9)v(99) COMP-3.
OUTPUT file :
02 WS-VAR-B PIC 9,999,999.99.
I need necessary cobol code to move
WS-VAR-A TO WS-VAR-B
Any suggestions are welcome. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
move WS-VAR-A TO WS-VAR-B
truncation might occur..... |
|
Back to top |
|
|
leo_sangha
New User
Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
the pic clause of WS-VAR-B is NOT Pic 9999999.99.
it is PIC 9,999,999.99.
Something like 9(,Comma)999(,Comma)999.99
Please correct me if i am missing something. |
|
Back to top |
|
|
leo_sangha
New User
Joined: 11 Aug 2005 Posts: 85 Location: England
|
|
|
|
it worked thanks ... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
It will work until the value in A is ten million or greater. The tens of millions and hundreds of millions will not fit into B. B is defined to handle a value up to nine million, nine hundred ninety-nine thousand, nine hundred ninety-nine point 99 - 10million and higher will fail.
In COBOL, 9(9)v99 specifies 11 total positions with an implied 2 decimals. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
leo_sangha wrote: |
the pic clause of WS-VAR-B is NOT Pic 9999999.99.
it is PIC 9,999,999.99.
Something like 9(,Comma)999(,Comma)999.99
Please correct me if i am missing something. |
And what is your point? The move works into a numeric edit field, it is no longer numeric, now it is display. |
|
Back to top |
|
|
sunilm
New User
Joined: 18 Aug 2006 Posts: 3 Location: Pune
|
|
|
|
I have to move the WS-AMT PIC S9(16)V99 COMP-3 to
WS-AMT-B PIC S9(14).99
I moved the value and written in the output file then I view the file the Amounts are not displayed properly.
for EX.the value -2983444.45 is displayed as 299L}}} like this.
Can anyone please help in this regards. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1050 Location: Richmond, Virginia
|
|
|
|
You don't want both "S" (internal sign) and "." (explicit decimal point) in the same picture. Is your field internal or external?
You also would want the number of target field digits to be not less than the source field's. Since your source has a sign ("S"), you should have an explicit sign position int he target - e.g., either + or -. |
|
Back to top |
|
|
sunilm
New User
Joined: 18 Aug 2006 Posts: 3 Location: Pune
|
|
|
|
I want the sign and decimal point in the output file.It does not matter internal or External.I want all the numbers in the input feild to the Target field including sign and decimal point |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
You do not want the S in the output. If you want to see the sign, you need to include a minus-sign '-' in the output definition. Do you want the output to be -123.77 or 123.77-? You may have the minus sign on either side. You also need to account for all of the digits in the output definition - your definition will not handle all of the digits in the "sending" field. Do you want the result padded with zeros?
Please post a few amounts (up to the maximum number of digits) and how you want the output and we will give you the output definition that will do what you want.
It does matter if it is "internal or External". Internal is for the computer and external is for the eyes. |
|
Back to top |
|
|
sunilm
New User
Joined: 18 Aug 2006 Posts: 3 Location: Pune
|
|
|
|
Millions of Thanks to Phil and Dick,Its worked,I was not aware of external and internal your answer gave the clear Picture..........
Hope to get this type of immediate response in the future...
Regards
Sunilm |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
You're welcome, Sunilm.
Hopefully, you will |
|
Back to top |
|
|
|