Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Does moving a value of S9(9) COMP-4 to 9(04) works fine?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
ideas

New User


Joined: 25 May 2005
Posts: 53
Location: India

PostPosted: Tue Apr 25, 2006 11:55 am    Post subject: Does moving a value of S9(9) COMP-4 to 9(04) works fine?
Reply with quote

dear all,

Does moving a value of S9(9) COMP-4 variable to to 9(04) works fine?

thanks!
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Tue Apr 25, 2006 12:32 pm    Post subject: Does moving value of S9(9) COMP-4 to 9(04) works fine ??
Reply with quote

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
View user's profile Send private message
muthukumar

New User


Joined: 24 Mar 2004
Posts: 29

PostPosted: Tue Apr 25, 2006 12:58 pm    Post subject: Re: Does moving a value of S9(9) COMP-4 to 9(04) works fine?
Reply with quote

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
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Tue Apr 25, 2006 1:13 pm    Post subject:
Reply with quote

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
View user's profile Send private message
vijayakumar.yellala

New User


Joined: 19 Apr 2006
Posts: 63
Location: Chennai

PostPosted: Wed Apr 26, 2006 1:59 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Apr 29, 2006 7:35 pm    Post subject:
Reply with quote

To complete the discussion you must code the receiving field as
PIC S9(10) to avoid truncation and preserve the sign.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Sat Apr 29, 2006 11:24 pm    Post subject:
Reply with quote

Hi all,

It work fine.........but you have to care bat the truncation .......as mmwife told is correct.............



Thanks
Shri
Back to top
View user's profile Send private message
jayanta_nit

New User


Joined: 13 Apr 2006
Posts: 22
Location: hyderabad

PostPosted: Thu May 04, 2006 2:16 pm    Post subject: Re: Does moving a value of S9(9) COMP-4 to 9(04) works fine?
Reply with quote

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
View user's profile Send private message
jayanta_nit

New User


Joined: 13 Apr 2006
Posts: 22
Location: hyderabad

PostPosted: Thu May 04, 2006 2:19 pm    Post subject: reagarding comp-4
Reply with quote

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
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Thu May 04, 2006 2:28 pm    Post subject:
Reply with quote

Its all depend upon the legth of the field.

but you can move

correct me If I am wrong

Thanks
Shri
Back to top
View user's profile Send private message
jayanta_nit

New User


Joined: 13 Apr 2006
Posts: 22
Location: hyderabad

PostPosted: Thu May 04, 2006 2:29 pm    Post subject: Does moving a value of S9(9) COMP-4 variable to to 9(04)
Reply with quote

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
View user's profile Send private message
jayanta_nit

New User


Joined: 13 Apr 2006
Posts: 22
Location: hyderabad

PostPosted: Thu May 04, 2006 2:31 pm    Post subject: Re: Does moving a value of S9(9) COMP-4 to 9(04) works fine?
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat May 06, 2006 7:08 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving UDB database to Db2 on z/OS Keith Hooley DB2 4 Wed Sep 27, 2017 12:38 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Moving a PD to PD spoorni DFSORT/ICETOOL 8 Fri Oct 07, 2016 9:52 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us