passing parameters in the routine

  • omeja
  • Topic Author
  • Visitor
  • Visitor
11 years 1 month ago #15983 by omeja
passing parameters in the routine was created by omeja
hello Friends am trying to do a routine that can automatically charge commission on accounts with LCS AND LGS issued ''SUBROUTINE TB.LCS.LGS' called with incorrect arguments , Line 1 , Source N
Trap from an error message, error message name = SUBROUTINE_PARM_ERROR
Line 1 , Source EB.EXECUTE.APPLICATION'


bellow is my routine
* <Rating>-22</Rating>
* BY OSBERT

*
SUBROUTINE TB.LCS.LGS(AC.NO,Y.FRM,Y.TO,BASE.AMT,BASE.CCY)


$INSERT I_COMMON
$INSERT I_EQUATE
$INSERT I_F.ACCOUNT
$INSERT I_F.COMPANY
$INSERT I_F.CUSTOMER
$INSERT I_ENQUIRY.COMMON
$INSERT I_F.ACCT.ACTIVITY
$INSERT I_F.FUNDS.TRANSFER
$INSERT I_F.CURRENCY
$INSERT I_F.MNEMONIC.COMPANY




GOSUB OPENFILE
GOSUB GET.AC
RETURN

OPENFILE:
*DEBUG
*AC.NO = '0010273738'


FN.CURR = 'F.CURRENCY' ; F.CURR = ''
CALL OPF(FN.CURR,F.CURR)



FN.COM = 'F.COMPANY' ; F.COM = ''
CALL OPF(FN.COM,F.COM)


Y.TD.DATE = TODAY
Y.DATE=Y.TD.DATE
Y.YEAR=Y.DATE[1,4]
Y.MONTH=Y.DATE[5,2]
IF Y.MONTH = '01' THEN
Y.MONTH = '12'
Y.YEAR -= 1
END ELSE
Y.MONTH -= 1
Y.MONTH = FMT(Y.MONTH,"R%2")
END
IF Y.MONTH = '02' THEN
IF MOD(Y.YEAR,4) = 0 THEN
Y.END.DATE='29'
END ELSE
Y.END.DATE='28'
END
END ELSE
* A = INDEX('04 06 09 11',Y.MONTH,1)
IF INDEX('04 06 09 11',Y.MONTH,1) > 0 THEN
Y.END.DATE='30'
END ELSE
Y.END.DATE='31'
END
END

START.DATE = Y.YEAR:Y.MONTH:'01'
Y.DAY=Y.YEAR:Y.MONTH:Y.END.DATE
Y.FRM = START.DATE
Y.TO = Y.DAY

GET.AC:

FN.ACC = 'F.ACCOUNT'; F.ACC = ''
CALL OPF(FN.ACC,F.ACC)

CALL F.READ(FN.ACC,AC.NO,R.ACC.REC,F.ACC,E.ACC)

*OPEN.DATE = R.ACC.REC<AC.OPENING.DATE>
ACC.CAT = R.ACC.REC<AC.CATEGORY>
ACC.CUST = R.ACC.REC<AC.CUSTOMER>
ACC.BALL = R.ACC.REC<AC.OPEN.ACTUAL.BAL>
LOCAL.POS = ''
CALL GET.LOC.REF('ACCOUNT','EXPIRY.DATE',LOCAL.POS)
ACC.EXP.DATE = ''
ACC.EXP.DATE = R.ACC.REC<AC.LOCAL.REF,LOCAL.POS>

CALL GET.LOC.REF('ACCOUNT','COMMISSION.RATE',LOCAL.POS)
COMM.RATE = ''
COMM.RATE = R.ACC.REC<AC.LOCAL.REF,LOCAL.POS>

IF ACC.EXP.DATE GT Y.DATE THEN
CHARG.AMT = ''
CHARG.AMT = COMM.RATE*ACC.BALL
CHARG.AMT = ABS(CHARG.AMT)
IF CHARG.AMT LE 50000 THEN
CHARG.AMT = 50000
END
IF ACC.CAT EQ 9110 OR ACC.CAT EQ 9120 OR ACC.CAT EQ 9140 OR ACC.CAT EQ 9150 OR ACC.CAT EQ 9160 THEN


SEL.CMD2 = 'SSELECT ':FN.COM

CALL EB.READLIST(SEL.CMD2,SEL.LIST2,'',NO.REC2,Y.ERR2)

FOR KK = 1 TO NO.REC2
Y.ID.COM = SEL.LIST2<KK>
CALL F.READ(FN.COM,Y.ID.COM,R.REC.COM,F.COM,ERR.COM)
MNE = R.REC.COM<EB.COM.MNEMONIC>
FN.ACC = 'F':MNE:'.ACCOUNT' ; F.ACC = ''
CALL OPF(FN.ACC,F.ACC)
SEL.AC = 'SELECT ':FN.ACC:''

CALL EB.READLIST(SEL.AC,AC.LIST,'',NO.AC,Y.ACERR)
FOR XX = 1 TO NO.AC
ACC.ID = ''
ACC.ID = AC.LIST<XX>
CALL F.READ(FN.ACC,ACC.ID,R.ACC.REC,F.ACC,ACC.ERR)
Y.CUS = R.ACC.REC<AC.CUSTOMER>
BASE.CCY = R.ACC.REC<AC.CURRENCY>

IF ACC.CUST EQ Y.CUS THEN
* BASE.AMT = ''
* BASE.CCY = ''
BASE.AMT = CHARG.AMT
BASE.CCY = R.ACC.REC<AC.CURRENCY>

END ELSE

BASE.AMT = 0
BASE.CCY = R.ACC.REC<AC.CURRENCY>
END

NEXT XX

NEXT KK

END ELSE

BASE.AMT = 0
BASE.CCY = R.ACC.REC<AC.CURRENCY>

END

RETURN

END

and the error Message is
_BNK/SYSTEM.END.OF.DAY3_IC.COB_2_07 MAY 2014_13:27:31_Standard multi-thread job
_BNK/SYSTEM.END.OF.DAY3_IC.COB_2_07 MAY 2014_13:27:31_Calling load routine
_BNK/SYSTEM.END.OF.DAY3_IC.COB_2_07 MAY 2014_13:27:32_Obtained the Locking with9
_BNK/SYSTEM.END.OF.DAY3_IC.COB_2_07 MAY 2014_13:27:32_Using list file F.JOB.LIS9
_BNK/SYSTEM.END.OF.DAY3_IC.COB_2_07 MAY 2014_13:27:32_Control list processing 3
Invalid or uninitialised variable -- NULL USED ,
Var (UNKNOWN) , Line 128 , Source CALC.IC.CHARGE
_BNK/SYSTEM.END.OF.DAY3_IC.COB_2_07 MAY 2014_13:27:32_Fatal error in CALC.IC.CH*
jsh live ~ -->

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
11 years 1 month ago #15990 by jpb
Replied by jpb on topic passing parameters in the routine
Hi Osbert,
still working on this routine (it was last summer, wasn't it?) :-)
Have you ever made it work ?? Which release do you run ???

Please Log in or Create an account to join the conversation.

  • omeja
  • Topic Author
  • Visitor
  • Visitor
11 years 1 month ago #15997 by omeja
Replied by omeja on topic passing parameters in the routine
the one your talking about worked already this on is diff but close the other one was charging accounts with no activity in a month and this one is charging commission on Letters of guarantee and letters of credit

Please Log in or Create an account to join the conversation.

  • jpb
  • jpb's Avatar
  • Offline
  • Moderator
  • Moderator
  • retired . . . ¯\_(ツ)_/¯
More
11 years 1 month ago #15999 by jpb
Replied by jpb on topic passing parameters in the routine
1. There is no RETURN at the end of OPENFILE
2. The RETURN at the end of GET.AC is inside the "IF ACC.EXP.DATE GT Y.DATE THEN"
(these is only 'cosmetics', the routine runs thu anyhow)

I can't see the reason why you loop thru all companies and inside each company thru all accounts to find any account for the same customer with out any stop-condition. If the last account you read is not of the same customer you always end up with BASE.AMT = 0 and BASE.CCY = R.ACC.REC<AC.CURRENCY> . . .
I suppose there are better ways to do this, at least you can use SEL.AC = 'SELECT ':FN.ACC:' WITH CUSTOMER EQ ':ACC.CUST

But all this won't explain the thrown error :-(

Is it possilbe that the VOC for the routine is pointing to a wrong BP ???
Do you have the complete messages (not truncated, set wrap or enlarge the number of columns in your emulation) ?

Please Log in or Create an account to join the conversation.

More
11 years 4 weeks ago #16065 by cemtezer
Replied by cemtezer on topic passing parameters in the routine
Hi, if i am not wrong. your subroutine(which is TB.LCS.LGS) is called by CALC.IC.CHARGE and your routine has 5 parameters. (AC.NO,Y.FRM,Y.TO,BASE.AMT,BASE.CCY). I think, when you call this routine there are missing variables to get from CALC.IC.CHARGE.
calling routines variables must be same with call routines. be sure these variables are same between CALC.IC.CHARGE and TB.LCS.LGS.
and jpb told true. you forgot "RETURN" statement before GET.AC function. this missing is not depand on your error but another problem may occur.

Please Log in or Create an account to join the conversation.

Time to create page: 0.049 seconds