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

Can we move any data from Alphanumeric to Comp-3 variables?


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

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Mon Feb 19, 2007 10:24 am
Reply with quote

Hi all,
can we move any data from alphanumeric to comp-3 or comp variables?
or do we need to move initially from alphanumeric to numeric and then move to comp variables?

Thanks!
Rathna.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Mon Feb 19, 2007 10:52 am
Reply with quote

Hi There,

Topic is already discussed

ibmmainframes.com/viewtopic.php?t=16807&highlight=alphanumeric+comp3
Back to top
View user's profile Send private message
crrindia

Active User


Joined: 02 Jul 2005
Posts: 124
Location: Gurgaon

PostPosted: Tue Feb 20, 2007 5:29 pm
Reply with quote

Hi Ekata, I have gone thru that link but i couldn't understand the solution from the link
if you have any idea please let me know.

Thanks!
Rathna.
Back to top
View user's profile Send private message
arindam111

New User


Joined: 29 Nov 2006
Posts: 27
Location: India

PostPosted: Tue Feb 20, 2007 5:39 pm
Reply with quote

I have just ran this code, it works. Its self explanetory.
Code:

IDENTIFICATION DIVISION.   
PROGRAM-ID. TEST4.         
ENVIRONMENT DIVISION.       
DATA DIVISION.             
WORKING-STORAGE SECTION.   
                           
77 A PIC X(4) VALUE '9999'.
77 B PIC 9(4) COMP-3.       
                           
PROCEDURE DIVISION.         
1000-MAIN-PARA.             
      MOVE A TO B.         
      DISPLAY "B= " B.     
1000-EXIT.                 
     STOP RUN.             
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: Tue Feb 20, 2007 9:56 pm
Reply with quote

Hello,

If you do this, you must first check the x field for a valid numeric value. If the value in the A field were changed to 'QQ2*' you will have problems.
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Fri Feb 23, 2007 2:52 pm
Reply with quote

yes dick is rigth
if the alphanumeric contains the numeric value
then then it works
but if alphanumeris contains othere than numeric value then it not works
soc7 or maxcc
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 Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top