Can we convert packed decimal value to decimal value using sort? If yes can you please tell me how can I do it.
My requirement is,
I have a FB file of length 400 bytes.
1) First 30. Bytes is name
2) 31st to 35 bytes is key
3) 36th byte to 45th byte packed decimal amount value
I need to check the key value at 31st position and copy packed decimal value to 36th position if key value is 1130 and if key value is 1131 I need to copy packed decimal value to 46th position and if key value 1132 I need to copy packed decimal value to 55th position, depending on key value I need to copy the packed decimal value after converting it to decimal
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Hima1985 wrote:
3) 36th byte to 45th byte packed decimal amount value
I need to copy packed decimal value to 46th position and if key value 1132 I need to copy packed decimal value to 55th position, depending on key value I need to copy the packed decimal value after converting it to decimal
Hima 1985,
36-45 byte packed decimal field is 10 bytes. A readable format of that require at least 22 bytes ( 20 bytes of numeric 1 byte sign and 1 byte decimal point ). How are you planning to accommodate 22 bytes in 10 bytes?
Thank you, it worked. But one small problem ifthen. 1131 and 1132 its converting packed decimal to decimal and placing the value in 46th position and 55th position but, the packed decimal value at 35th position is remaining same there in output record.
but there is no way your output is as you show it.
Kolusu's edit mask does not suppress leading zeros,
and your first ABCABCXYZ, the 1130 is left shifted one char.