View previous topic :: View next topic
|
Author |
Message |
saidharrao Warnings : 1 New User
Joined: 19 Feb 2005 Posts: 27 Location: hyderabad-ap-india
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
PIC 9(8) COMP is not packed, COMP-3 would be packed. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
How is this post different from this post from the same O/P on the same topic? |
|
Back to top |
|
|
saidharrao Warnings : 1 New User
Joined: 19 Feb 2005 Posts: 27 Location: hyderabad-ap-india
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
saidharrao Warnings : 1 New User
Joined: 19 Feb 2005 Posts: 27 Location: hyderabad-ap-india
|
|
|
|
Hi,
I have used similar concept and able to do that but using COMP.
Many Thanks. |
|
Back to top |
|
|
|