on 05-24-2016 1:27 PM
Hi Experts
I have a requirement where I should call a PCR in another PCR. Suppose ZWTM is a pcr which has T/F as return value.
It is used in another rule say ZKTM say by using PCYGZWTM. If ZWTM returns T then remaining branches of ZKTM has
to get executed. How can I capture the return value T/F of ZWTM inside rule ZKTM without IF and ENDIF.
Thanks in advance
This can be achieved as below:
1. Payroll pcr with a condition checking pcr ZWTM
1.1 lines in the initiating PCR
P PCY ZWTM *
1 NUM=& ZTRU* OBTAIN CONDITION FROM VAR. ZTRU
2 D NUM?0 CONDITION FALSE?
* Z GCY ZWTT - NO, TRUE; GO TO PCR FOR TRUE
= Z GCY ZWTF -YES, FALSE, GO TO PCR FOR FALSE
1.2 PCR ZWTM check condition and set true/false
ZERO=&ZTRU* SET VAR ZTRU TO 0, INDICATING FALSE CONDITION
.... Check condition - e.g., PSA, pay scale, etc.
.... If ok, set condition as true (NUM=1)
NUM=1 ADDWT&ZTRU
2. Time eval pcrs: You can use a utility time type, say ZTRU with zero or 1 to indicate true/false
2.1 calling pcr
P PCY ZWTM *
D HRS=DZTRU HRS?0 Cond.false?
* Z GCY ZWTT
= Z GCY ZWTF
2.2 pcr ZWTM
HRS=0 ADDDBZTRUZ SET T/T ZTRU TO ZERO
.... | Check condition - e.g., PSA, pay scale, etc. |
HRS=1 ADDWBZTRU
Note the char Z at the end of ADDDB op'n sets the current value of the t/t to the current value of HRS.
3. Alternatively, following can be used in the calling pcr:
3.1 In the calling pcr, check conditions instead of in ZWTM pcr.
e.g., check PA, PSA, contract type, P/T or F/T (as found in IT 7 or with emp.%.
If condition is true, go to pcr ZWTT, else to ZWTF.
Please note:
a. If the first character in the column for an operation = '*' (asterisk), it is equivalent to using NEXTR, i.e., go to next line. This can be used if you have a full PCR line with operations and you want to go to next line; in this case NEXTR can't be used.
b. Remi's suggestion is correct but the lines can be used in a schema or sub-schema. IF is a schema function but not an operation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mani,
In Jagan's example, you would not have to create 2 other pcrs since ZWTM would be called by a Function other than IF, such as PIT.
In this scenario, instead of using Operation GCY, you could use Operation PAYTP, as in PAYTP F or PAYTP T, where F and T are the branches for False and True.
What Operation are you using to get those return values?
Note that if you are using Operation SCOND (Set Condition) in your pcr, then all the return values to your Queries (other Operations) must also use Operation SCOND and the pcr must be called by Function IF.
To answer your requirement, try copying the True and False parts of ZWTM into ZWTT and ZWTF, then modify your schema with the following
IF ZWTM
ACTIO ZWTT (if ZWTM's condition is True)
ELSE
ACTIO ZWTF (if ZWTM's condition is False)
ENDIF
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you pls share ZWTM PCR?
You can use same PCR like this
ZWTM
*
****
Condition
True
PCY ZWTMT
False
PCY ZWTMF
T
****
True Logic
F
****
False Logic
Thanks,
Ketul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
107 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.