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

How to display COMP values?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
saidharrao
Warnings : 1

New User


Joined: 19 Feb 2005
Posts: 27
Location: hyderabad-ap-india

PostPosted: Wed Jan 23, 2008 9:02 pm
Reply with quote

Hi,

In IMS database definition a field is defined as TYPE=X, hence I have defined the type of the corresponding field in IO-area copybook as

03 A PIC 9(08) comp (might be wrong but was working when used a client supplied routine. But for invalid dates the routine returns hex zeroes whereas I want the date to be packed). I want to know how the packing and unpacking has to be done in the following process.

Process 1: Read the field from IMS - Convert into display format - display on the screen

Process 2: Receive from screen - pack it - save in the database.

Can you please advise me how can it be done. Please note that, there are more than 1000 copybooks which has this definition and hence cannot change the copybook definition. We have to use 'some intermediatory' process only.
The ultimate field type should be 9(08) COMP.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jan 23, 2008 9:13 pm
Reply with quote

PIC 9(8) COMP is not packed, COMP-3 would be packed.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jan 23, 2008 9:15 pm
Reply with quote

How is this post different from this post from the same O/P on the same topic?
Back to top
View user's profile Send private message
saidharrao
Warnings : 1

New User


Joined: 19 Feb 2005
Posts: 27
Location: hyderabad-ap-india

PostPosted: Thu Jan 24, 2008 3:26 am
Reply with quote

Hi,
Sorry for the duplicate posts. I couldn't find the previous post and hence reposted with more details. I wonder if it is possible to delete one with less info.

I know Comp-3 is packed decimal and Comp is binary. But as I explained.I am using a COMP field to retrieve the data from IMSDB which is hexa decimal. Though the type is COMP, the actual data will be in USP (Unsigned Packed decimal). I tried moving that directly to display field and didn't work.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Jan 24, 2008 4:56 am
Reply with quote

As an example, suppose the IMSDB data is 4-bytes "Packed-Nosign", which is equal to X'01020304' and could be regarded as BCD (Binary Coded Decimal).

If you need to address this data as Packed-Decimal (COMP-3) and retain the original value, try the following -

Code:

03  WS-IMSDB-PACKED-NOSIGN PIC X(04) VALUE X'01020304'.
03  WS-PACKED-X PIC X(05).
03  WS-PACKED-V9 REDEFINES WS-PACKED-X PIC 9(08)V9 COMP-3.
03  WS-IMSDB-PACKED-RESULT PIC 9(09) COMP-3.

MOVE WS-IMSDB-PACKED-NOSIGN TO WS-PACKED-X (1:4).
MOVE X'0F' TO WS-PACKED-X (5:).
MOVE WS-PACKED-V9 TO WS-IMSDB-PACKED-RESULT.


The result in WS-IMSDB-PACKED-RESULT will be X'001020304F', which is in Packed-Unsigned (Neutral) format.

If you had moved this original IMSDB data to a Binary-Fullword and then converted this value to Decimal, the Signed Packed-Decimal result would have been P'16909060', which would have been meaningless.

Going back many years ago, NCR COBOL once had a format named COMP-6, which was truly "Packed-Nosign", but IBM COBOL never had such a format.

HTH....

Regards,

Bill
Back to top
View user's profile Send private message
saidharrao
Warnings : 1

New User


Joined: 19 Feb 2005
Posts: 27
Location: hyderabad-ap-india

PostPosted: Fri Jan 25, 2008 3:55 pm
Reply with quote

Hi,
I have used similar concept and able to do that but using COMP.

Many Thanks.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top