View previous topic :: View next topic
|
Author |
Message |
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
I have coded a REXX Program, to read the contents of a file into a stem variable.
I'm trying to add a particular position in the file, say 100,10
I'm aware it is a decimal value, but when I try to add it, The value of the stem is like
How do I convert or read that position from the stem as decimal Value? |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
You've been asked before to do this on other topics. Post the content of the data in question as hexadecimal. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
I believe that you will use the Rexx built-in C2D function. |
|
Back to top |
|
|
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
here is the data, 15,8 is the position.
Code: |
0----+----1----+----2----+----3---
<
Ñèð
Ñèæ
< â&
< â&
< -
< Ëj @
`Îæ
Ìn
ê
% á
% ø
< ã°
< ã°
< ã°
< ã° |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
You might get better help if You would post the hex representation of the <things> |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Post the content of the data in question as hexadecimal |
And yet you post the unneeded "display" content.
Use HEX ON and show the hex. . . |
|
Back to top |
|
|
HameedAli
Active User
Joined: 16 Apr 2009 Posts: 151 Location: India
|
|
|
|
Excuse me for the drag. Please help me out in getting 115,8 as decimal value in REXX
Code: |
0----+----1----+----2----+----3----+----4----+----
Ñèð
44444444444010000000658000000000000000044444444444
000000000005C0C0000594C0000000C0000000C00000000000
-------------------------------------------------
Ñèæ
44444444444010000000659000000000000000044444444444
000000000005C0C0000594C0000000C0000000C00000000000
-------------------------------------------------
< â&
44444444444040000000450000000000000000044444444444
000000000005C0C0000020C0000000C0000000C00000000000
-------------------------------------------------
< â&
44444444444040000000450000000000000000044444444444
000000000005C0C0000020C0000000C0000000C00000000000 |
|
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Hameed Ali,
Akatsukami has already suggested something that may work.
for the future:
do you even bother to debug this stuff that you write,
or do you just blindly execute and when it does not work, ask for a solution?
you should have run this using TRACE, which would have provided you with something to work with.
This is a very easy and elemental problem to debug. you need to increase your skill level,
as well as,
provide people answers to their questions.
This silliness has been going on for 2 hours and you are nowhere near
solving your problem.
and another thing. obviously your are a beginner at REXX
and
have not bother to learn or understand the language.
everything in REXX is char (x-type).
there are many functions which will convert data from one datatype to another.
you need to read. |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Actually, Hameed, none of the records that you have chosen to display contain the value 115.8, so you will never see that as your output from this sample.
Nonetheless, try this:
- Substring the packed decimal number to work variable #1
- Use work variable #1 as the argument to the C2D function giving work variable #2
- Insert a decimal separation into work variable #2 at the appropriate place (note that there is no inherent means of representing scale in packed decimal numbers; you have to know where it is)
- Use as desired.
|
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
If you find at some point that you want to convert packed-decimal to decimal, you can try the P2D function shown in this previous topic. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2594 Location: Silicon Valley
|
|
|
|
It is not clear what this has to do with "Read Decimal Value from JCL into REXX". |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1787 Location: Bloomington, IL
|
|
|
|
Probably because the OP's request actually has nothing to do with "read decimal value from JCL into Rexx". |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Not sure if this applies to this topic, but unfortunately, we have many participants who believe that inline/instream data, code, or control statements are JCL . . . |
|
Back to top |
|
|
|