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

Alpha numeric to COMP-3


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Convert HEX to Numeric DB2 3
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
Search our Forums:

Back to Top