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
 

 

How to display COMP values?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: How to display COMP values?
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    Post subject:
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

Moderator Team Head


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

PostPosted: Wed Jan 23, 2008 9:15 pm    Post subject: Reply to: How to display COMP values?
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    Post subject: Reply to: How to display COMP values?
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Thu Jan 24, 2008 4:56 am    Post subject: How to display COMP values?
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    Post subject: Reply to: How to display COMP values?
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    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 Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us