Posted: Sun Feb 03, 2008 1:33 pm Post subject: Change from binary [S9(8) comp] to binary [S9(4) comp]
Hi Everyone,
I'm facing a situation where in I have to change the length of a field of input file from S9(8) comp to S9(4) comp into the output file using SORT. I have tried it change it directly as
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Sun Feb 03, 2008 7:11 pm Post subject:
Quote:
But it is giving me unexpected results.
This doesn't really tell us anything, so I can only guess what the problem is.
S9(8) comp and S9(4) comp are signed values - that's what the S means. With signed comp values, plus values have leading zeros whereas minus values have leading ones.
BI is an unsigned format, so it can handle the plus values correctly, but not the minus values.
FI is a signed format that can handle the plus and minus values correctly. So if you do have minus values, you need to use FI rather than BI.
If that isn't the problem/solution, then you need to give more details about the unexpected results such as what the input value looks like in hex and what the "incorrect" output value looks like in hex. _________________ 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
Actually, the situation is that we have a file which is having the field with value as S9(8) comp, and we need to change it to S9(4) comp. by truncating the leading 4 bytes which we are assuming to be ZEROS always.
eg. if we have data in i/p file as "00005678" then o/p file should have "5678" with proper sign.
So I tried to use this with the SORT card (as stated above) to convert the BI data directly from S9(8) comp to S9(4) comp. but it did not worked( I checked in FILE-AID, the last 4 bytes are not the same, it seems they are displayed in binary format).
I have also tried to convert the BI to ZD using INREC and again from ZD to BI using OUTREC.
I'm getting the last 4 bytes as expected, but I'm not able to handle the sign in the output.If you need I can provide this sort card also.
Note: The input file can have both -ive and +ive values
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Mon Feb 04, 2008 11:28 am Post subject:
deepesh123,
You seem to be totally confused about the various data formats, lengths, etc. You don't seem to know if your input field is in BI format, FI format, ZD format, etc. So it's difficult to help you.
You say you want to change from S9(8) comp to S9(4) comp. S9(8) comp is 4 bytes. S9(4) comp is 2 bytes. Yet you say you want to truncate the leading 4 bytes even though the original input field is only 4 bytes. And you go back and forth about whether the values can be negative or not. I don't see how you can expect anyone to help you with all of the confusing misinformation you're posting.
You show
362:362,4,BI,BI,LENGTH=2
So I'm assuming the field you want to convert is in positions 362-365. Run the following job to display the values in hex, and post the SORTOUT output ... perhaps that will help me determine what format you actually have for the input field.
_________________ 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
Sorry for all the confusion, actually the input file has data in BI format only(362-365) and we have to convert it from 4 bytes to 2 bytes (i.e from S9(8) comp to S9(4) comp).
As suggested I'm sending you the result of sysout for your Job
09458587
094589DE
09458E35
0945928C
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Feb 07, 2008 10:24 am Post subject:
So your first input field has value X'09458587'. That means it has significant data in all 4 bytes. You can't "convert" that to 2 bytes without losing significant data. If you convert it to a 2-byte BI value using
362,4,BI,BI,LENGTH=2
it will be X'8587' so you will lose the first two bytes of X'0945'. Thus, it's unclear what you're trying to do or what result you'd want for this conversion. _________________ 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