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
 

 

Assembly NI (AND) operation in SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Fri Sep 28, 2012 1:59 pm    Post subject: Assembly NI (AND) operation in SORT
Reply with quote

Is there a way to do Assembly level AND operation in SORT

I have the below piece which executes TM and NI instruction
Code:
1  TM   9(RX),X'0C'
   BO   2         
2  NI    9(RX),X'F0'

TM instruction is replaced using the BI datatype as shown below.. But not sure about the AND operation.
Code:
 SORT FIELDS=COPY                       
 INREC IFTHEN=(WHEN=(9,1,BI,BO,X'0C'), 
       BUILD=(???))   

Please let me know if this is possible.
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Fri Sep 28, 2012 2:59 pm    Post subject: Reply to: Assembly NI (AND) operation in SORT
Reply with quote

As a "quickie" you can define as binary, divide by 16 then multiply by 16.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Sep 28, 2012 11:43 pm    Post subject: Reply to: Assembly NI (AND) operation in SORT
Reply with quote

kratos86,

As bill mentioned you can divide and multiply by 16 treating it as a BI.

Use the following

Code:

//SYSIN    DD *                                       
  SORT FIELDS=COPY                                   
  INREC IFTHEN=(WHEN=(9,1,BI,BO,X'0C'),               
  OVERLAY=(9:(9,1,BI,DIV,+16),MUL,+16,BI,LENGTH=1)) 
//*
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Oct 02, 2012 10:12 pm    Post subject:
Reply with quote

Alternatively you can use the TRAN=BIT and TRAN=UNBIT parms to get the desired results

Assuming LRECL=80 and RECFM=FB. we first convert the byte at position 9 to bits in position 81 and then replace the end portion with zeros and then use UNBIT to put it back at position 9.
Code:

//SYSIN    DD *                                         
  SORT FIELDS=COPY                                     
  INREC IFOUTLEN=80,IFTHEN=(WHEN=(9,1,BI,BO,X'0C'),     
  OVERLAY=(81:9,1,TRAN=BIT,85:4C'0',9:81,8,TRAN=UNBIT))
//*
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Oct 03, 2012 1:03 pm    Post subject: Reply to: Assembly NI (AND) operation in SORT
Reply with quote

Another variant. Uses a hex constant (X'...') on SYMNAMES for the '0C' value (since it will be used in two places).

The constant is appended to the end of the record, then a SUBtract, with both fields specified as BInary. May be useful where a bit pattern exists, but where other bits are required to retain their value, zero or non-zero (1).

Code:
//STEP0100 EXEC PGM=SORT
//SYMNAMES DD *
HEX-0C,X'0C'
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  OPTION COPY
  INREC IFOUTLEN=80,
        IFTHEN=(WHEN=(9,1,BI,BO,HEX-0C),
  OVERLAY=(81:HEX-0C,
           9:9,1,BI,SUB,81,1,BI,TO=BI,LENGTH=1))
//SORTIN   DD *


EDIT: It is of course possible to arrange to only affect certain bits with Kolusu's neat BIT/UNBIT solution. In the example, it would be

Code:
...86:2C'0'...


leaving the 5th and 8th bits unchanged. There would be nothing to stop the setting of more than one non-contiguous bits either.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Wed Oct 03, 2012 2:32 pm    Post subject:
Reply with quote

Thank you Bill and Kolusu...
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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