PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

Swap the values of two similarly-defined variables without a temporary holding variable

View previous topic View next topic Go down

Swap the values of two similarly-defined variables without a temporary holding variable

Post  maran on Mon Dec 12, 2011 12:57 am

THIS CAN BE ACHIEVED BY USING %BITXOR BIF

This code fragment illustrates that technique.
D Var1 s 8a
D Var2 s 8a

/free
Var1 = 'PMS INFO';
Var2 = 'INFO PMS';

Var1 = %bitxor(Var1: Var2);
Var2 = %bitxor(Var1: Var2);
Var1 = %bitxor(Var1: Var2);
after this code runs, Var1 has the value "INFO PMS" and Var2 has the value "PMS INFO"
avatar
maran
Admin

Posts : 442
Join date : 2009-07-24

View user profile http://pmsinformationsystem.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum