Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 COMP Variables Mismatch gayu7 COBOL Programming 5 Wed Dec 20, 2017 5:06 pm
No new posts Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us