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 File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm

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