View previous topic :: View next topic
|
Author |
Message |
ideas
New User
Joined: 25 May 2005 Posts: 52 Location: India
|
|
|
|
dear all,
Does moving a value of S9(9) COMP-4 variable to to 9(04) works fine?
thanks! |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Quote: |
Does moving a value of S9(9) COMP-4 variable to to 9(04) works fine? |
Did you face any problem in that ??
S9(9) occupies 4 Bytes, it would be a normal COBOL MOVE moving a S9(9) COMP-4 variable to 9(04).
Regards,
Priyesh. |
|
Back to top |
|
|
muthukumar
New User
Joined: 24 Mar 2004 Posts: 29
|
|
|
|
All,
I am hearing first time on this comp-4 type. can you please throw some lights on how this will get stored and what is the use of this type of declations.
thanks & regards
Muthu |
|
Back to top |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Hi,
COMP-4 and Binary or COMP all are same. So you can move the
S9(9) COMP-4 variable to 9(04).
Correct me if I am Wrong.
Thanks
Shri |
|
Back to top |
|
|
vijayakumar.yellala
New User
Joined: 19 Apr 2006 Posts: 63 Location: Chennai
|
|
|
|
Hi Boss....
S9(9) COMP it will take 4 bytes, then 9(4) also will take 4 bytes only..
but here we are moving value of S9(9) Comp, here the length of the field S9(9) Comp is 9 ,
if we move the S9(9) to 9(4), the value will tructe....
Correct me , if i am wrong....
Regards |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
To complete the discussion you must code the receiving field as
PIC S9(10) to avoid truncation and preserve the sign. |
|
Back to top |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Hi all,
It work fine.........but you have to care bat the truncation .......as mmwife told is correct.............
Thanks
Shri |
|
Back to top |
|
|
jayanta_nit
New User
Joined: 13 Apr 2006 Posts: 22 Location: hyderabad
|
|
|
|
hi,
i think it will not work fine bacause s9(9) comp-4 will take (9+1)=5 bytes,and if we want to move this value to 9(04) then left most value will be truncated..pls correct me if i'm wrong.
Regards
Jayanta kr. mondal |
|
Back to top |
|
|
jayanta_nit
New User
Joined: 13 Apr 2006 Posts: 22 Location: hyderabad
|
|
|
|
hi muthukumar,
as far i knw hat comp-3 and comp-4 are the same type i,e packed decimal format..
regards
jayanta |
|
Back to top |
|
|
shrivatsa Warnings : 1 Active User
Joined: 17 Mar 2006 Posts: 174 Location: Bangalore
|
|
|
|
Its all depend upon the legth of the field.
but you can move
correct me If I am wrong
Thanks
Shri |
|
Back to top |
|
|
jayanta_nit
New User
Joined: 13 Apr 2006 Posts: 22 Location: hyderabad
|
|
|
|
hi,
i think it will not work fine bacause s9(9) comp-4 will take (9+1)/2=5 bytes,and if we want to move this value to 9(04) then left most value will be truncated..pls correct me if i'm wrong.
Regards
Jayanta kr. mondal |
|
Back to top |
|
|
jayanta_nit
New User
Joined: 13 Apr 2006 Posts: 22 Location: hyderabad
|
|
|
|
hi,
i think it will not work fine bacause s9(9) comp-4 will take (9+1)/2=5 bytes,and if we want to move this value to 9(04) then left most value will be truncated..pls correct me if i'm wrong.
Regards
Jayanta kr. mondal |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Jayanta,
What you described is not how the length of a COMP/COMP-4/BINARY field is determined; that's how a COMP-3 field is determined.
Do a search on COMP and/or COMP-4 for an explanation |
|
Back to top |
|
|
|