IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to move the value from S9(16)V99 comp-3 to x(50)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Thu Jul 26, 2007 4:37 pm
Reply with quote

Hi,

i had a query regarding the movements of values.

When i am trying to move negative values or decimal values to an alphanumeric field i am getting some junk values.
Is this movement not possible?
The below are my actual movements i need
i want to move the value from S9(16)V99 comp-3 to x(50)
How can i do this.

Also can anyone please tell me where can i find all possible movements.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Jul 26, 2007 4:47 pm
Reply with quote

What do you consider "junk values"? The last digit?
The move is possible, but without editing, the sign and decimal point will be a problem.
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Thu Jul 26, 2007 4:47 pm
Reply with quote

hi bhasker,

You can;t view comp-3 value. You need to convert COmp-3 value to numeric (display format) before moving to X(50).

~Vamsi
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jul 27, 2007 3:29 am
Reply with quote

Hello,

To move from comp-3 to pic x, you should move thru an intermediate zoned decimal field.

Quote:
Also can anyone please tell me where can i find all possible movements.

The link below shows valid and invalid elementary moves. That link is inside the COBOL Language Reference linked to via the "Manuals" link at the top of the web page.
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3lr10/6.2.24.1?SHELF=&DT=20020920180651&CASE=
Back to top
View user's profile Send private message
bhaskar_kanteti

Active User


Joined: 01 Feb 2007
Posts: 123
Location: Hyderabad

PostPosted: Fri Jul 27, 2007 8:57 am
Reply with quote

Hi,

[/quote]To move from comp-3 to pic x, you should move thru an intermediate zoned decimal field.
Quote:


You mean to say S9(13)V9(2) COMP-3 to 9(13)V9(2) and then to x(20).
Is this correct.

Or is this movement correct. I will move S9(13)V(2) COMP-3 to the below group variable and then to x(20). Is this correct.
10 group-varibale.
15 var-1 pic 9(13).
15 var-2 pic x(1) value '.'.
15 var-3 pic 9(2).

I am trying all the ways. If any one has any idea tell me.
Back to top
View user's profile Send private message
Umamaheswari K

New User


Joined: 23 May 2007
Posts: 2
Location: chennai

PostPosted: Fri Jul 27, 2007 9:30 am
Reply with quote

You could use edited picture clause. first move comp-3 variable value to the edited picture clause variable. Then you could move that edited variable to the alphanumeric variable.This would be easy .

Uma..
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Jul 27, 2007 1:46 pm
Reply with quote

Right justified?

01 from9 pic S9(16)V99 comp-3
01 tox pic x(50)
01 temp pic -z(15)9.99
move from9 to temp
move temp to tox
display tox

01 tox
05 temp pic -z(35)9.99
move from9 to temp
display tox

left justified?

01 filler
05 tox pic x(50) value spaces
05 temp redefines tox pic -z(15)9.99
move from9 to temp
display tox
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jul 27, 2007 7:27 pm
Reply with quote

Hello,

Depending on how you need the output from the move, you could use various techniques.
Quote:
You mean to say S9(13)V9(2) COMP-3 to 9(13)V9(2) and then to x(20).
This move will get numbers you can see in the pic x field, but there will be no decimal point shown and no minus sign if the value was negative. If the value was negative you would get the letter J thru the letter R (-1 to -9) or one of these ({ } - i don't recall which is -zero).

If you want to see the "-" and the decimal point, you could use "01 temp pic -z(15)9.99 " as Bill suggests.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
No new posts How to move DB2 Installation HLQ DB2 4
Search our Forums:

Back to Top