Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help Required For Use of HEX Values

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Help Required For Use of HEX Values
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    Post subject: Re: Help Required For Use of HEX Values
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: 3158
Location: Tucson AZ

PostPosted: Fri Nov 24, 2006 2:44 pm    Post subject:
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    Post subject: Re: Help Required For Use of HEX Values
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: 3158
Location: Tucson AZ

PostPosted: Fri Nov 24, 2006 3:45 pm    Post subject:
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    Post subject: Re: Help Required For Use of HEX Values
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: 3158
Location: Tucson AZ

PostPosted: Fri Nov 24, 2006 4:24 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm
No new posts Remove junk values in a file and rite... KP1125 DFSORT/ICETOOL 2 Wed Jan 25, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us