View previous topic :: View next topic
|
Author |
Message |
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
how to set high value to the variable defined with type FIXED BIN(31,0).
e.g:
DCL RECV_PARM1 FIXED BIN(31);
and how to set high value to RECV_PARM1;
after that how to judge if the variable is high value or not?
please have a guide... |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
the z principles of operations will tell all You need to know on number representation in computers ... |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
You could
Code: |
DCL RECV_PARM1 FIXED BIN(31);
DCL RECV_PARM1_OV CHAR(4) BASED(ADDR(RECV_PARM1));
RECV_PARM1_OV = HIGH(4);
IF RECV_PARM1_OV = HIGH(4)
THEN...... |
Garry. |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
Garry Carroll wrote: |
You could
Code: |
DCL RECV_PARM1 FIXED BIN(31);
DCL RECV_PARM1_OV CHAR(4) BASED(ADDR(RECV_PARM1));
RECV_PARM1_OV = HIGH(4);
IF RECV_PARM1_OV = HIGH(4)
THEN...... |
Garry. |
in called procedure I defined as:
DCL SEND_PARM1 FIXED BIN(31);
DCL SEND_PARM1_OV CHAR(4) BASED(ADDR(SEND_PARM1));
SEND_PARM1_OV = HIGH(4);
in calling procedure I define as:
DCL RECV_PARM1 FIXED BIN(31);
DCL RECV_PARM1_OV CHAR(4) BASED(ADDR(RECV_PARM1));
after called,I checked RECV_PARM1_OV,it is not high value... |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
I think you need to review the scope of your variables, the call to the called procedure and the PROC statement of the called procedure.
Unless you are passing the address of SEND_PARM1 in the call, and resolving it in the called PROC , the RECV_PARM1 and RECV_PARM1_OV are local to the called procedure - and out of scope for the calling procedure.
Garry. |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
as written in PLI Language Reference:
Unless an argument is passed BYVALUE, a reference to an argument, not its value, is generally passed to a subroutine or function. This is known as passing arguments by reference, or BYADDR. A reference to a parameter in a procedure is a reference to the corresponding argument. Any change to the value of a parameter is actually a change to the value of the corresponding argument.
and refer to my replies above,actually what I need is that in the called function procedure the SEND_PARM1 should be set to high value,and in the calling procedure RECV_PARM1 is corresspoding to SEND_PARM1.And if SEND_PARM1 is set to high value,RECV_PARM1 should also be the high value as said in Language Reference.
So the key point is how to really set SEND_PARM1 with the high value?
|
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
henry888 wrote: |
how to set high value to the variable defined with type FIXED BIN(31,0).
e.g:
DCL RECV_PARM1 FIXED BIN(31);
and how to set high value to RECV_PARM1;
after that how to judge if the variable is high value or not?
please have a guide... |
Just what value do you consider to be 'high value' in DCL RECV_PARM1? |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Set it to negative 1 and all will be foregiven....
Or (if you like using cycles) set it to 0 then subtract 1.
Bill |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
"Just what value do you consider to be 'high value' in DCL RECV_PARM1?"
I also have the same question...but it is needed in the requirement.
I know in COBOL language it is like 'FFFFFFFF',but merely to mention this word in PLI,any idea? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
for a FIXED BIN(31,0) does 2**31 hint anything ??? |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1205 Location: Dublin, Ireland
|
|
|
|
Can you show the code for the CALL statement and the start of the called procedure?
youy should have
Code: |
CALL subproc(SEND_PARM1); |
and
Code: |
subproc: PROC(RECV_PARM1);
DCL RECV_PARM1 ...... |
Garry. |
|
Back to top |
|
|
henry888
New User
Joined: 21 Sep 2009 Posts: 51 Location: china
|
|
|
|
Bill O'Boyle wrote: |
Set it to negative 1 and all will be foregiven....
Or (if you like using cycles) set it to 0 then subtract 1.
Bill |
it is right...from data storage to see,FFFFFFFF = -1 |
|
Back to top |
|
|
|