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

UNSPEC


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kishore balya

New User


Joined: 17 Oct 2007
Posts: 12
Location: chennai

PostPosted: Fri Sep 04, 2009 10:36 am
Reply with quote

UNSPEC in pl/1 converts the given format to a bit string.
can any one explain in scenarios we will use this?
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Sep 04, 2009 10:45 am
Reply with quote

System related tasks:

Code:
abend_code: proc(ch4) returns(char(5));     
dcl ch4 char       (4);                     
dcl w4b fixed bin (31);                     
dcl w4  char       (4) based(addr(w4b));   
dcl p4  pic     '9999';                     
                                           
unspec(w4) = unspec(ch4) & '00fff000'bx;   
if unspec(w4) then                         
  do;                                       
    return('S' !! substr(hex(w4), 3, 3));   
  end;                                     
else                                       
  do;                                       
    unspec(w4) = unspec(ch4) & '00000fff'bx;
    p4         = w4b;                       
    return('U' !! p4);                     
  end;                                     
end abend_code;


Fast divide:
Code:
      2 h1       fixed        (15,5) init (0),
  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
dcl r(n)         fixed          (15) ctl;     
  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
unspec(h1) = unspec(r(i));


Masking:

Code:
/**********************************************************************
* Round requested size up to next multiple of 8 bytes (allocations in *
* area's are always done in multiples of 8 bytes) Use of 'UNSPEC' is  *
* substantially faster than the equivalent 'trunc(i_size / 16) * 16'  *
**********************************************************************/
I_SIZE         = I_SIZE + 7;                                           
UNSPEC(I_SIZE) = UNSPEC(I_SIZE) & 'FFFFFFF8'BX;
Back to top
View user's profile Send private message
kishore balya

New User


Joined: 17 Oct 2007
Posts: 12
Location: chennai

PostPosted: Fri Sep 04, 2009 11:10 am
Reply with quote

Thanks a lot prino..
if possible can you explain the masking process
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Fri Sep 04, 2009 11:48 am
Reply with quote

kishore balya wrote:
if possible can you explain the masking process


Holy crap, why can't you just try it yourself with a few values for I_SIZE (it's a FIXED BIN (31)), look at the results and see the pattern?
Back to top
View user's profile Send private message
kishore balya

New User


Joined: 17 Oct 2007
Posts: 12
Location: chennai

PostPosted: Fri Sep 04, 2009 11:59 am
Reply with quote

I am not havinG mainframe connection as of now..
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 -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts UNSPEC in PL1. PL/I & Assembler 1
No new posts What is use of UNSPEC builtin functio... PL/I & Assembler 3
Search our Forums:

Back to Top