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: 4649
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: 10274
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
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts REXX WTO for console message bipinpeter CLIST & REXX 6 Tue Jun 27, 2017 3:56 pm
No new posts Convert CLIST to REXX cvnlynn CLIST & REXX 12 Tue Jun 27, 2017 2:06 am


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