Posted: Thu Feb 01, 2007 8:21 am Post subject: Reverse a COMP-2 Amount in a file
I have an FB file with LRECL= 2562 and Amount 8 bytes in position
2403-2410. My requriement is to copy this file as it is with only the amount
reversed. If the amount is 100 then the output file should have -100
and for -100 the the amount to be 100
The amount starts in position 2403.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Feb 01, 2007 12:52 pm Post subject:
COMP-2 is an 8-byte floating point value. Are you asking if you can reverse the sign of a COMP-2 value to create another COMP-2 value?
If so, the sign of a COMP-2 value is indicated by its first bit (bit 0) - 0 for positive or 1 for negative. So to reverse the sign, you need to flip the first bit. If it's 1, change it to 0. If it's 0, change it to 1. Here's a DFSORT job that does that:
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Thank you Frank. Exactly what I needed.
This raises another question. Is it possible to convert this Amount in a readable form with the + or - sign just to compare the original files before conversion and after?
Output is FB file with LRECL= 2562 and Amount starting position 2403
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri Feb 02, 2007 11:01 am Post subject:
Here's a DFSORT job that will display the FL values as integer values (note that you will lose the decimal places but this should be good enough for your purpose).
You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's FL display function. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum