IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help Required For Use of HEX Values


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ihatesugar
Warnings : 1

New User


Joined: 22 Oct 2006
Posts: 43

PostPosted: Fri Nov 24, 2006 1:51 pm
Reply with quote

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
View user's profile Send private message
surya_pathaus

Active User


Joined: 28 Aug 2006
Posts: 110

PostPosted: Fri Nov 24, 2006 2:29 pm
Reply with quote

Hi,

Can you post your piece of code with the variable declarations of 2 bytes field, 1byte field.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Nov 24, 2006 2:44 pm
Reply with quote

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
View user's profile Send private message
ihatesugar
Warnings : 1

New User


Joined: 22 Oct 2006
Posts: 43

PostPosted: Fri Nov 24, 2006 3:41 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Nov 24, 2006 3:45 pm
Reply with quote

Try reading all replys before posting answers....
Back to top
View user's profile Send private message
ihatesugar
Warnings : 1

New User


Joined: 22 Oct 2006
Posts: 43

PostPosted: Fri Nov 24, 2006 4:13 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Nov 24, 2006 4:24 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Generate output lines (SYSIN card for... DFSORT/ICETOOL 4
Search our Forums:

Back to Top