Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 4650
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: 10375
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 Looping REXX - unable to interrupt RAVISANKAR07 CLIST & REXX 3 Wed Dec 06, 2017 1:08 pm
No new posts The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
This topic is locked: you cannot edit posts or make replies. Rexx to Grab ISMF Information. upendrasri All Other Mainframe Topics 16 Sun Nov 26, 2017 12:35 am
No new posts Rexx to send an email without SMTP Se... upendrasri All Other Mainframe Topics 12 Sun Nov 19, 2017 7:59 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us