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

Move simple DECIMAL to CHAR


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 3156
Location: Tucson AZ

PostPosted: Tue Jan 30, 2007 4:37 pm
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Need Help with Packed Decimal Signs DFSORT/ICETOOL 4
Search our Forums:

Back to Top