Swap the values of two similarly-defined variables without a temporary holding variable
Page 1 of 1
Swap the values of two similarly-defined variables without a temporary holding variable
THIS CAN BE ACHIEVED BY USING %BITXOR BIF
This code fragment illustrates that technique.
D Var1 s 8a
D Var2 s 8a
/free
Var1 = 'MITH ARG';
Var2 = 'ARG MITH';
Var1 = %bitxor(Var1: Var2);
Var2 = %bitxor(Var1: Var2);
Var1 = %bitxor(Var1: Var2);
after this code runs, Var1 has the value "ARG MITH" and Var2 has the value "MITH ARG"
This code fragment illustrates that technique.
D Var1 s 8a
D Var2 s 8a
/free
Var1 = 'MITH ARG';
Var2 = 'ARG MITH';
Var1 = %bitxor(Var1: Var2);
Var2 = %bitxor(Var1: Var2);
Var1 = %bitxor(Var1: Var2);
after this code runs, Var1 has the value "ARG MITH" and Var2 has the value "MITH ARG"
Archana K- Posts : 76
Join date : 2013-01-27
Age : 32
Location : chennai
Similar topics
» Remove Program Temporary Fix
» Comparison of DDS and SQL-Defined Files
» Now V7R1 - Default parameter values are supported for both SQL and external stored procedures
» *LDA error message "DtaAra already defined"
» Replacing variable with FILLER in a Copybook
» Comparison of DDS and SQL-Defined Files
» Now V7R1 - Default parameter values are supported for both SQL and external stored procedures
» *LDA error message "DtaAra already defined"
» Replacing variable with FILLER in a Copybook
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|