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

Assembly NI (AND) operation in SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Sep 28, 2012 2:59 pm
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
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
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Oct 03, 2012 1:03 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top