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
 

 

How to dispay packed-decimal variables using rexx ??

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
harry143

New User


Joined: 05 Nov 2007
Posts: 21
Location: hyd

PostPosted: Wed Jan 30, 2008 4:33 pm    Post subject: How to dispay packed-decimal variables using rexx ??
Reply with quote

I have a sequential file with some records in it. I want to write some of the records to an output file based on some calculations on the fields in the input file.

But the input file record contains packed-decimal variables. So while I am trying to extract that fields using rexx, I am unable to diplay them nor able to do any calculations sine they are packed-decimal fields.

How Can I convert the packed-decimal variables in the input file to the regural decimal format such that I can do the calculations using rexx and write into the input file.
Back to top
View user's profile Send private message

superk

Moderator Team Head


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

PostPosted: Wed Jan 30, 2008 4:37 pm    Post subject: Reply to: How to dispay packed-decimal variables using rexx
Reply with quote

Here are two previous topics:

http://www.ibmmainframes.com/viewtopic.php?t=17235
http://www.ibmmainframes.com/viewtopic.php?t=4511
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Wed Jan 30, 2008 5:21 pm    Post subject: Reply to: How to dispay packed-decimal variables using rexx
Reply with quote

just a snippet ...
adjust to your needs

Code:

...
packed = subst(Your_record,Start_pos,Length)
number = unpack(packed)
...
exit

unpack: procedure
    parse arg pack

    /* Convert packed data to hex and split */
    char = c2x(pack)
    numb = left( char, length(char)-1 )
    sign = right( char, 1 )

    /* Check sign and numeric sections */
    if  verify(sign, "ABCDEF" ) > 0 then ,
        return ""
    if  verify( numb, "0123456789" ) > 0 then ,
        return ""
             
    /* Check negative sign */
    if  pos(sign, "BD" ) > 0 then,
        return -numb
    else ,
    return  numb
Back to top
View user's profile Send private message
harry143

New User


Joined: 05 Nov 2007
Posts: 21
Location: hyd

PostPosted: Thu Jan 31, 2008 5:09 pm    Post subject: Reply to: How to dispay packed-decimal variables using rexx
Reply with quote

Thanks!!!
It is working fine
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am


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