View previous topic :: View next topic
|
Author |
Message |
coolsyam
New User
Joined: 29 Jun 2006 Posts: 3
|
|
|
|
Hi
I want to convert a 5 byte Alphanumeric field into a 4 byte alphanumeric field.ie X(05) to X(04).
If the input is numeric we move a 5 byte into a 4 byte without truncation, using packed format like S9(8) comp-3.But here my problem is that the input is Alphanumeric.In case the source is AN, this move will give u a S0C7 abend.
If we prepare a mapping table,the number of combinations is very large.
Any suggestions |
|
Back to top |
|
|
prasadvrk
Active User
Joined: 31 May 2006 Posts: 200 Location: Netherlands
|
|
|
|
I have not tried this but try this.
Redefine the moved into AN field as numeric one and check if sending field IS-NUMERIC, if numeric move it to the numeric redefined field else move it to the AN field.
Let me know if you succeed. |
|
Back to top |
|
|
coolsyam
New User
Joined: 29 Jun 2006 Posts: 3
|
|
|
|
Hi
If the input is numeric ,it will work , we can use some comp fileds for compression.My problem is it culd be any valid numeric or alphabet at any position.say can example ABCDE or ABC123 likewise.Even if it is ABCDE i need to convert it uniquely into a 4 byte field.
Any suggestion on base conversion or so ?? |
|
Back to top |
|
|
IQofaGerbil
Active User
Joined: 05 May 2006 Posts: 183 Location: Scotland
|
|
|
|
Is that it?
Is there anything you are not telling us? |
|
Back to top |
|
|
coolsyam
New User
Joined: 29 Jun 2006 Posts: 3
|
|
|
|
I will clarify my requirement in detail
Input is 5 byte Alphanumeric .I need to convert it into a 4 byte Alphanumeric to store it in my master file.
No truncation should happen.We should be able to convert it back to 5 byte alphanumeric also.
I had once successfully tried converting a 5 byte alphanumeric to 4 byte numeric.But in that case the last 3 byte of the AN input was always numeric.So I used a Base10-> base36 conversion algorithm to do this conversion(ie last 3 byte numeric to 2 byte) so total 5 byte to 4 byte.
But here the problem is that It could be any valid numeric or alphabet at any position from 1 to 5.
I think its an interesting challenge .Can any one take it Up |
|
Back to top |
|
|
|