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
 

 

Alpha numeric to COMP-3

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

New User


Joined: 01 Mar 2005
Posts: 52
Location: Mysore

PostPosted: Tue Jul 05, 2005 10:33 am    Post subject: Alpha numeric to COMP-3
Reply with quote

When alpha numeric value is the moved to Comp/COMP-3 it is displaying the following result, instead of giving SOC7 Abend.

DATA DIVISION.

WORKING-STORAGE SECTION.
01 A PIC X(4) VALUE 'ABCD'.
01 B PIC S9(2) COMP-3.
01 U PIC S9(2) COMP.

PROCEDURE DIVISION.
MOVE A TO B.
MOVE A TO U.
DISPLAY B.
DISPLAY U.

Output:
34
34


Can anyone please clarify this????
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jul 10, 2005 4:51 am    Post subject:
Reply with quote

Hi Mouli,

As I recall, it goes something like this:

Moving a 4 pos A/N field to a 2 pos PD field, the hi ord 2 bytes of the sending field are truncated.

So, you wind up w/"CD" to be packed into the PD field. CD is X'C3C4'
The pack assembler instruction changes that to X'034C' or X'034F' depending on the NUMPROC option selected at compile time.

When DISPLAY does its magic it converts the X'034F' to X'F0F3F4' (034) or the X'034C' to X'F0F3C4' (03D).

I'm surprised it didn't DISPLAY as 034. That may be because the PIC was defined as 99.
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
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 How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 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