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

Move from Numeric to Alphanumeric


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

New User


Joined: 22 Sep 2008
Posts: 8
Location: Bangalore

PostPosted: Fri Oct 30, 2009 8:06 pm
Reply with quote

Hi All,
I have a boubt
A PIC X(04) 'ABCD'
B PIC S9(05) '10000'

If i move from B to A -------- > Result ?
if i move from A to B ---------> Result?

Coulf you please tell me...


Thanks,
Vamsi Varanasi
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Oct 30, 2009 8:17 pm
Reply with quote

Basic syntax errors in your post: (1) no level numbers on the variables, (2) B cannot have quotes around the value literal, (3) VALUE is not optional, and (4) periods are recommended.

I ran this code:
Code:
           05  A-FROM                  PIC X(04)  VALUE 'ABCD'.
           05  B-TO                    PIC S9(05) VALUE 10000.
           05  A-TO                    PIC X(04)  VALUE 'ABCD'.
           05  B-FROM                  PIC S9(05) VALUE 10000.

      /
       PROCEDURE DIVISION.
       S1000-MAIN       SECTION.
           MOVE A-FROM                 TO  B-TO.
           MOVE B-FROM                 TO  A-TO.
           DISPLAY 'A FROM: ' A-FROM.
           DISPLAY 'A TO:   ' A-TO.
           DISPLAY 'B FROM: ' B-FROM.
           DISPLAY 'B TO:   ' B-TO.
and got results of
Code:
 A FROM: ABCD
 A TO:   1000
 B FROM: 1000{
 B TO:   0ABCD
Which is precisely what you would expect by reviewing the rules for elementary MOVE statements in the COBOL Language Reference manual (link at the top of the page).
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
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 Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
Search our Forums:

Back to Top