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

Read Decimal Value from JCL into REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Tue Oct 05, 2010 9:04 pm
Reply with quote

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

Code:
     j @

Code:
     f


How do I convert or read that position from the stem as decimal Value?
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Oct 05, 2010 9:29 pm
Reply with quote

You've been asked before to do this on other topics. Post the content of the data in question as hexadecimal.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Oct 05, 2010 9:30 pm
Reply with quote

I believe that you will use the Rexx built-in C2D function.
Back to top
View user's profile Send private message
HameedAli

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Tue Oct 05, 2010 10:16 pm
Reply with quote

here is the data, 15,8 is the position.
Code:
0----+----1----+----2----+----3---
            <                     
                    Ñèð           
                    Ñèæ           
            <       â&           
            <       â&           
                                 
            <        -           
            <      Ëj @           
                    `Îæ           
                    Ìn           
                    ê            
            %       á             
            %        ø           
            <       ã°           
            <       ã°           
            <       ã°           
            <       ã°           
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 05, 2010 10:22 pm
Reply with quote

You might get better help if You would post the hex representation of the <things>
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Oct 05, 2010 10:45 pm
Reply with quote

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

Active User


Joined: 16 Apr 2009
Posts: 151
Location: India

PostPosted: Tue Oct 05, 2010 10:54 pm
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Oct 05, 2010 11:02 pm
Reply with quote

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

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Oct 05, 2010 11:05 pm
Reply with quote

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:
  1. Substring the packed decimal number to work variable #1
  2. Use work variable #1 as the argument to the C2D function giving work variable #2
  3. 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)
  4. Use as desired.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Oct 05, 2010 11:18 pm
Reply with quote

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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Oct 05, 2010 11:36 pm
Reply with quote

searching forums for my posts with "REXX PACK UNPACK"
will certainly point You to ...

ibmmainframes.com/viewtopic.php?t=41407&highlight=rexx+pack+unpack

which in turn will suggest

ibmmainframes.com/viewtopic.php?t=31547&postdays=0&postorder=asc&start=15

ibmmainframes.com/viewtopic.php?t=27921&highlight=rexx+pack+unpack
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed Oct 06, 2010 1:44 am
Reply with quote

It is not clear what this has to do with "Read Decimal Value from JCL into REXX".
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Oct 06, 2010 2:04 am
Reply with quote

Probably because the OP's request actually has nothing to do with "read decimal value from JCL into Rexx".
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Oct 06, 2010 2:37 am
Reply with quote

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
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 -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top