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 from Numeric to Alphanumeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Move from Numeric to Alphanumeric
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: 7936
Location: Bellevue, IA

PostPosted: Fri Oct 30, 2009 8:17 pm    Post subject:
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    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 Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 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


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