Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Move simple DECIMAL to CHAR

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

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Tue Jan 30, 2007 4:24 pm    Post subject: Move simple DECIMAL to CHAR
Reply with quote

this is what i want,,,

ws-b-caliper is 0.030
to be
zz-b-caliper 030 (only decimals in char attribute)

BELOW coding is not working...

MOVE WS-B-CALIPER TO ZZ-B-CALIPER
MOVE ZZ-B-CALIPER TO XX-B-CALIPER

01 WS-B-CALIPER PIC 9V999 COMP.
01 ZZ-B-CALIPER PIC 9V999.
01 XX-B-CALIPER PIC X(4).

"ZZ-B-CALIPER (NUMERIC NON-INTEGER)" AND "XX-B-CALIPER (ALPHANUMERIC)" DID NOT FOLLOW COMPATIBILITY RULES. THE STATEMENT WAS DISCARDED.

Any idea?

Thanks in advance,
Jordi
Back to top
View user's profile Send private message

prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Tue Jan 30, 2007 4:34 pm    Post subject:
Reply with quote

Very simple U cannot move a assumed decimal variable to alphanumeric variable, but if ya try to move a numeric varible with no assumed decimal point it would work icon_biggrin.gif

Cheer's,

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

Global Moderator


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

PostPosted: Tue Jan 30, 2007 4:37 pm    Post subject:
Reply with quote

Code:
01  filler.
   05 WS-B-CALIPER PIC 9V999 COMP.
   05 ZZ-B-CALIPER PIC 9V999.
   05 XX-B-CALIPER redefines zz-b-caliper PIC X(4).


MOVE WS-B-CALIPER TO ZZ-B-CALIPER
now XX-B-CALIPER is "0030"
Back to top
View user's profile Send private message
mshashio

New User


Joined: 24 Apr 2006
Posts: 4

PostPosted: Tue Jan 30, 2007 5:17 pm    Post subject: Re: Move simple DECIMAL to CHAR
Reply with quote

Define 01 ZZ-B-CALIPER PIC 9V999 as
01 ZZ-B-CALIPER PIC 9.999
then it will work
Back to top
View user's profile Send private message
jruiza

New User


Joined: 31 Aug 2005
Posts: 23

PostPosted: Tue Jan 30, 2007 10:19 pm    Post subject: Re: Move simple DECIMAL to CHAR
Reply with quote

IT'S WORKING NOW


T H A N K S
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jan 31, 2007 7:23 am    Post subject:
Reply with quote

The simplest solution:

Code:
 MOVE WS-B-CALIPER TO ZZ-B-CALIPER
MOVE ZZ-B-CALIPER(2:) TO XX-B-CALIPER

If you want a leading space code XX-B-CALIPER with VALUE SPACE then

MOVE ZZ-B-CALIPER(2:) TO XX-B-CALIPER(2:)

If you want a leading zero code XX-B-CALIPER with VALUE ZERO and MOVE accordingly.
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
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts Need information on COBOL MOVE CORRES... subratarec COBOL Programming 10 Tue Jun 28, 2016 10:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us