Skip to Content
author's profile photo Former Member
Former Member

Allocation Script Logic - performance of coding

Hello,

I have an allocation script logic and I would like to know whether there is room for performance improvement or not. I have two questions concerning this.

1)

Depending on prompt variables, the user should select the period for which the allocation rule shall be executed. As written below $ALLOCTIME$ variable leads to an error in *FOR/NEXT loop while validating the script. Do I have other alternatives to use prompt variables within script logic? What is the difference between using PROMPT(SELECTINPUT,,,...) and the prompt used below? May I use PROMPT(SELECTINPUT,,,) to pass variables for the dimension VERSION from prompt to script logic?

2)

Is there room for improving this allocation logic? E.g. It takes 70sec to calculate and write back 7000 data records (1 period calculated in FOR/NEXT loop) or about 5min to calculate and write back 25000 data records (4 periods calculated in FOR/NEXT loop). Are there any experiences concerning high data volume?

Any answers appreciated.

Thank you very much in advance

Stefan

///// DATA MANAGER PROMPT /////

PROMPT(TEXT,%ALLOCVERS%,"Please select relevant version",)

PROMPT(TEXT,%ALLOCTIME%,"Please select time/period to execute allocation",)

INFO(%EQU%,=)

INFO(%TAB%,;)

TASK(ZPC_PROMPT_RUN_LOGIC,TAB,%TAB%)

TASK(ZPC_PROMPT_RUN_LOGIC,EQU,%EQU%)

TASK(ZPC_PROMPT_RUN_LOGIC,SUSER,%USER%)

TASK(ZPC_PROMPT_RUN_LOGIC,SAPPSET,%APPSET%)

TASK(ZPC_PROMPT_RUN_LOGIC,SAPP,%APP%)

TASK(ZPC_PROMPT_RUN_LOGIC,SELECTION,)

TASK(ZPC_PROMPT_RUN_LOGIC,LOGICFILENAME,LOGIC01_ALLOCFIX.LGF)

TASK(ZPC_PROMPT_RUN_LOGIC,REPLACEPARAM,ALLOCVERS%EQU%%ALLOCVERS%%TAB%ALLOCTIME%EQU%%ALLOCTIME%)

///// LOGIC01_ALLOCFIX.LGF //////

*SELECT(%CESET%,"[ID]",COSTELEMENT,"[ALLOCATION]='Y")

*XDIM_MEMBERSET COSTELEMENT=%CESET%

*XDIM_MEMBERSET VERSION=$ALLOCVERS$

*XDIM_MEMBERSET TIME=$ALLOCTIME$

*XDIM_MEMBERSET ITEM=IM_NONE

*XDIM_MEMBERSET COSTUNIT=CU_NONE

*XDIM_MEMBERSET ACTTYPE=AT_NONE

*XDIM_MEMBERSET DATASRC=ENTRY

*XDIM_MEMBERSET CALCTYPE=CA_FIX

*XDIM_MEMBERSET CRITERIA=CR_COST_FIX

*XDIM_MEMBERSET QUANTU=QU_NONE

*XDIM_MEMBERSET PCENTER=CP_NONE

*WHEN CALCTYPE

*IS "CA_FIX"

// Prompt variable $ALLOCTIME$ within *FOR/NEXT loop leads to an error while validating script. Nevertheless the allocation logic is executed correctly and leads to correct results.

*FOR %TIME% = $ALLOCTIME$

*FOR %COSTELEMENT% = %CESET%

*RUNALLOCATION

*FACTOR=USING/TOTAL

*DIM DATASRC WHAT=ENTRY; WHERE=ADJUSTM; USING=INPUT

*DIM ITEM WHAT=IM_NONE; WHERE=BAS(IM_RESULT); USING=<<<

*DIM TIME WHAT=%TIME%; WHERE=<<<; USING=<<<

*DIM COSTELEMENT WHAT=%COSTELEMENT%; WHERE=<<<; USING=<<<

*DIM PCENTER WHAT=PC_NONE; WHERE=BAS(PC_ALL); USING=<<<

*DIM COSTUNIT WHAT=CU_NONE; WHERE=BAS(CU_ALL); USING=<<<

*DIM ACTTYPE WHAT=AT_NONE; WHERE=BAS(AT_ALL); USING=<<<

*DIM QUANTU WHAT=QU_NONE; WHERE=BAS(QU_ALL); USING=<<<

*ENDALLOCATION

*NEXT

*NEXT

*ENDWHEN

*WHEN DATASRC

*IS "ENTRY"

*REC(EXPRESSION=0)

*ENDWHEN

*COMMIT

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    Posted on Jan 25, 2011 at 09:29 AM

    Hi Stefan,

    You are running this allocation once for every cost element. (This is happening because of the "*FOR %COSTELEMENT% = %CESET%" line.) Why is that necessary? I imagine that is slowing you down a lot as you probably have around 100 or more cost elements.

    I think you can just remove the dimension statement from your allocation logic for cost element and get the same result. You can also drop the *WHEN statement as it is not doing anything. I bet you put these in because it was allocating all your cost centers despite your memberset restriction.

    Apparently there is currently a bug in the allocation logic that causes it to reset the memberset selection, so you'll actually need to put your memberset declaration inside your *FOREACH loop, making it look something like:

    *FOR %TIME% = $ALLOCTIME$
    
    *XDIM_MEMBERSET COSTELEMENT=%CESET%
    *XDIM_MEMBERSET VERSION=$ALLOCVERS$
    *XDIM_MEMBERSET TIME=%TIME%
    *XDIM_MEMBERSET ITEM=IM_NONE
    *XDIM_MEMBERSET COSTUNIT=CU_NONE
    *XDIM_MEMBERSET ACTTYPE=AT_NONE
    *XDIM_MEMBERSET DATASRC=ENTRY
    *XDIM_MEMBERSET CALCTYPE=CA_FIX
    *XDIM_MEMBERSET CRITERIA=CR_COST_FIX
    *XDIM_MEMBERSET QUANTU=QU_NONE
    *XDIM_MEMBERSET PCENTER=CP_NONE
    
    *RUNALLOCATION
    *FACTOR=USING/TOTAL
    *DIM DATASRC WHAT=ENTRY; WHERE=ADJUSTM; USING=INPUT
    *DIM ITEM WHAT=IM_NONE; WHERE=BAS(IM_RESULT); USING=<<<
    *DIM TIME WHAT=%TIME%; WHERE=<<<; USING=<<<
    *DIM PCENTER WHAT=PC_NONE; WHERE=BAS(PC_ALL); USING=<<<
    *DIM COSTUNIT WHAT=CU_NONE; WHERE=BAS(CU_ALL); USING=<<<
    *DIM ACTTYPE WHAT=AT_NONE; WHERE=BAS(AT_ALL); USING=<<<
    *DIM QUANTU WHAT=QU_NONE; WHERE=BAS(QU_ALL); USING=<<<
    *ENDALLOCATION
    
    *NEXT
    

    Take this with a grain of salt as I'm not the best allocation logic expert, but hopefully that gets you on the right track 😊

    Ethan

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 21, 2015 at 08:44 AM
    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.