View previous topic :: View next topic
|
Author |
Message |
kennedy_zhu
New User
Joined: 30 Nov 2007 Posts: 27 Location: China
|
|
|
|
I want to translate alphanumeric '2345' into char 'ABCD', how to do it in easytrieve?
I try to define in working storage like that:
AA_RECORD 01 04 A
BB_RECORD 01 04 A
BB_RECORD_01 BB_RECORD 01 N
BB_RECORD_02 BB_RECORD +1 01 N
BB_RECORD_03 BB_RECORD +1 01 N
BB_RECORD_04 BB_RECORD +1 01 N
BB_RECORD_01 = 'A' + (BB_RECORD_01 - 1)
Unfortunately, I got error message '*******B055 INVALID LENGTH, TYPE OR DECIMAL PLACES - BB_RECORD_01'
do anybody know this situation? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
To do what i believe you want, you do not need to calculate anything.
Just compare the "input" field for '2345' and if it is equal move 'ABCD' to the "output" field.
Possibly there is something i do not understand |
|
Back to top |
|
|
kennedy_zhu
New User
Joined: 30 Nov 2007 Posts: 27 Location: China
|
|
|
|
Sorry for the confusion.
I really need to do the calculation, like we get value 1 in the first posion.
after the conversion, we would get value 'B' since 'A' + 1 is 'B'.
could we do that via the easytrieve? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Does this mean that the original 4-char values are not actually part of the requirement? There is no relation between 2345 and ABCD, or is there?
I believe you need to post much more complete examples of what data might arrive as input and how it should be converted for output.
What "rule" says that an input 1 should result in the calculaton of A + 1? What is the rule if an R is input? What if the input is zero or 9? |
|
Back to top |
|
|
kennedy_zhu
New User
Joined: 30 Nov 2007 Posts: 27 Location: China
|
|
|
|
all right.
the rule is when we get input value 2, after the calculation H - ( 2 - 1 ) , we would get value G,
when input value is 5, after the calculation H - ( 5 - 1), we get value D
so '1234' we get output 'GFED'. please ignore the previous value 'ABCD' |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
We are definitely circling around and around. . .
How could we have known or even guessed that we needed to grab an H to use in the calculation?
You need to clearly post all of the rules or you need to post a set of tables that show all of the value combinatoins.
I'll check back later - gong to be away for a while. |
|
Back to top |
|
|
kennedy_zhu
New User
Joined: 30 Nov 2007 Posts: 27 Location: China
|
|
|
|
ok.
rule is output letter = N - (input letter - 1)
table is following ->
input 1 2 3 4 5 6 7 8 9 0
output N M L K J I H G F O |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
kennedy,
The "rule" in your previous post was something like
Quote: |
output letter = H - (input number - 1) |
Now your latest post says
Quote: |
output letter = N - (input letter - 1) |
But still your input is a number and not a letter. I m confused |
|
Back to top |
|
|
|