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
 

 

Can we move a Alphanumeric to comp, comp-1

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

New User


Joined: 22 Jun 2004
Posts: 1
Location: Chennai

PostPosted: Wed Jun 23, 2004 5:22 pm    Post subject: Can we move a Alphanumeric to comp, comp-1
Reply with quote

Hai Friends,

Can we move a numeric or aplanumeric or alphabetic variables to a comp, comp-1 or comp-2 variables?
If it so what happened to the pic clause of the sending and receving variable?

Also can you pls provide me some examples for the various possible conditions of move statements?


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

priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Sat Jun 26, 2004 8:08 am    Post subject: Re
Reply with quote

You can move numeric to comp

But alphanumeric & alphabetic is not possible


Allowed Move

N / NE to AN / ANE

AN / ANE to A

and wise versa, except ANE to NE

Note: N - Numeric
NE - Numeric Edited

AN - Alphanumeric

ANE - AN Edited

A - alphanumeric
Back to top
View user's profile Send private message
DIVAKAR

New User


Joined: 26 Jun 2004
Posts: 3
Location: Trichy

PostPosted: Sat Jun 26, 2004 8:52 am    Post subject:
Reply with quote

hi pandian
we can move numeric value to comp,comp1 comp2 fileds

suppose

77 I pic 9999.
77 J PIC S9(4) COMP.

MOVE I TO J.

DATA :
I - 1234
J - 234

comp1
-------
77 I pic 9999.
77 J COMP1.

MOVE I TO J.

DATA :
I - 1234
J - .12340000E+4

comp2
-------
77 I pic 9999.
77 J COMP1.

MOVE I TO J.

DATA :
I - 1234
J - .1234000000000000E+4

Dhivakar - Trichy
Back to top
View user's profile Send private message
shammiullah

New User


Joined: 13 Jun 2005
Posts: 24

PostPosted: Tue Nov 15, 2005 11:41 pm    Post subject:
Reply with quote

77 I pic 9999.
77 J PIC S9(4) COMP.

MOVE I TO J.

DATA :
I - 1234
J - 234
................here is it for sure that if i display j it'll show 234.comp will internally take 2 bytes for j.so,where the sign will b stored.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Nov 16, 2005 11:32 pm    Post subject:
Reply with quote

Hi Sham,

J will contain 04D2, which is the binary equivilant of 1234. The sign is 0 (pos) in the hi ord bit of the hi ord byte.

If -1234 were moved to J, it would contain FB2E. The sign is 1 (neg) in the hi ord bit of the hi ord byte.
Back to top
View user's profile Send private message
mbr_raja

New User


Joined: 15 Nov 2004
Posts: 26
Location: Chennai, India

PostPosted: Wed Nov 16, 2005 11:55 pm    Post subject: RE:Can we move a numeric or aplanumeric to comp, comp-1
Reply with quote

You can move numeric or alphanumeric to comp, comp-1 etc, but the difference is as follows:

Move numberic to comp or comp-1 working fine

Move alphanumeric to comp or comp-1 SOC4 error


Since Comp and Comp-1 tries to stores the data in Hex format in the memory, but you cannot process or dispaly, If you try this, i leads SOC4 error.

01 c pic 99 comp.

Ex: move 123 to c

move "ABCD" to C
Back to top
View user's profile Send private message
shammiullah

New User


Joined: 13 Jun 2005
Posts: 24

PostPosted: Thu Nov 17, 2005 12:14 am    Post subject: Re: Can we move a numeric or aplanumeric to comp, comp-1
Reply with quote

hI MMWIFE,
WAT U'VE SAID IS RIGHT.....PREVIOUSLY SOME ONE HAS WRITTEN THAT I & J WILL CONTAIN 1234 AND 234.
BUT AS U'VE SAID IT'LL B LIKE
I-----1234
J-----123D IF ITZ DELARED AS S9(4)COMP.

IT'LL BE
I------1234
J------1234 IF ITZ DELARED AS 9(4)COMP.

CORRECT ME IF I'M WRONG...........THANK U.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Nov 17, 2005 1:38 am    Post subject:
Reply with quote

I'm assuming both I and J are signed. If you add another field - K with a
PIC S9(4) USAGE DISPLAY and move J to K, then:

The contents of K will be 123D if the 1234 is positive.
The contents of K will be 123M if the 1234 is negative.

If K is defined as PIC 9(4) USAGE DISPLAY, then K will contain
1234 in both cases.
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 Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 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