View previous topic :: View next topic
|
Author |
Message |
ihatesugar Warnings : 1 New User
Joined: 22 Oct 2006 Posts: 43
|
|
|
|
My current requirement is to move a two byte field in copybook to another field in copybook which is one byte. Then i pick up this one byte value and use it in another program
let me quote an example.
say my 2 byte field has value 12 --- earlier i had validation to move B to the one byte filed . and then down the line validate that if B , use 12.
it was working fine for limited number of digits(1-13).. now my requirement has changed , the value in 2 byte field can vary form 1-42.
so i dont want to use validation saying if 42 move z to 2 byte field and later use the same ,saying if z use 42.
Hope i was clear enough.
any suggestions would be welcome. does using hex values help .
say move x(13) to ws-1byte-field
if yes then , how to get the orignal number back from ws-ibyte-field . |
|
Back to top |
|
|
surya_pathaus
Active User
Joined: 28 Aug 2006 Posts: 110
|
|
|
|
Hi,
Can you post your piece of code with the variable declarations of 2 bytes field, 1byte field. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Code: |
01 filler.
05 temp-area pix s9(4) comp.
05 filler redefines temp-area.
10 filler pic x.
10 one-byte pic x.
01 copy-book.
05 cb-two pic 99.
05 cb-one pic x.
move cb-two to temp-area.
move one-byte to cb-one.
move zero to temp-area.
move cb=one to one-byte.
if temp-area = 12 use 12......
|
|
|
Back to top |
|
|
ihatesugar Warnings : 1 New User
Joined: 22 Oct 2006 Posts: 43
|
|
|
|
i cant really post the code for the same.
hope this helps
move '12' to ws-cpybk-2byte-field
if ws-cpybk-2byte-field = 12 then
ws-cpybk-onebyte-field = 'A'
-----
----
then the logic says
if ws-cpybk-onebyte-field = 'A'
ws-cpybk-2byte-field = 12
...initially the 2 byte fields had value 1 -12... so we implemented the above logic
now the values have changed to 1-42... so we dont want to go for hardocding to that extent....
this is happening in diff programs, being called for same requirement.
any suggestion..
doesnt using HEX values help in any way??? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Try reading all replys before posting answers.... |
|
Back to top |
|
|
ihatesugar Warnings : 1 New User
Joined: 22 Oct 2006 Posts: 43
|
|
|
|
i cant decipher your code. Can you be elabrote. please go thru the requirement once again. I am afraid i might have not been clear in expressing |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Move the two byte value to a numeric comp field.
Move the last byte of that comp field to the one byte field.
You now have the hex value of your two digit number in the single character field.
Insure that the initial value of the comp field is zero (low values).
Move the one byte field to the numeric comp field.
The numeric comp field is now equal to your original two byte value. |
|
Back to top |
|
|
|