Hello,
Quick Description of what I want to happen:
I want to write a pgm in which user give me a Date and a Currency. I then look up the Date in my DB, and return the FX Rate to the user.
How I would have like to sove the problem:
This is how I AM solving the problem:
My DateBase (PF) - XFXRATES.PF
My Program (RPGLE) - XFXRPGLE
My problem is that when I try to compile the program is get the following error:
RNF7595 The result data structure CURRATEDS does not include a subfield in position 1 for record format FXRATESREC.
Please be so kind as to advise me how to solve the RNF7595 problem as I could like to increase the number of currencies from 2 to 34.
Regards,
Christoff Erasmus
Quick Description of what I want to happen:
I want to write a pgm in which user give me a Date and a Currency. I then look up the Date in my DB, and return the FX Rate to the user.
How I would have like to sove the problem:
Code:
QryCur = 'EUR'; QryDate = %Date(); //Any date, used 2011-06-18 for example QryAmt = $1,000.00 Chain QryDate XFXRATES; //Random Read of my XFXRATES database ##################################################################### //The Database Fields for USD FX Rates Date || EUR || GBP 2011-06-18 || 0.9898 || 0.9999 ##################################################################### //Now I want to convert my USD amount into Euro's EuroAmt = QryAmt * Rate; //My Problem is to get Rate = 0.9898 //As this "should" happen Rate = Eur //But QryCur = 'EUR' which is a literal; so I can't just go Rate = (QryCur); //I believe that I have to perform a %Lookup with DataStructures and Arrays.(see below)
My DateBase (PF) - XFXRATES.PF
Code:
A UNIQUE A R FXRATESREC A CURDATE L TEXT('Date of the Currency Row') A GBP 9P 4 TEXT('Pound sterling') A USD 9P 4 TEXT('US dollar') A************************************************************************** A K CURDATE
Code:
FXFXRATES IF E K DISK //Currency DataStructure with overlayed Array D CurListDS DS D 3A Inz('GBP') D 3A Inz('USD') D CurListArray 3A Dim(2) OVERLAY(CurListDS) D CurRateDS DS D CurRateArray 9P 4 Dim(2) //------------------------------------------------------Global Variables D I S 2P 0 D QRYCUR S 3A Inz('USD') D QRYDATE S D Inz(*Sys) D BASECUR S 3A Inz('EUR') D BASEAMNT S 10P 0 Inz(*Zeros) D RATE S 7P 4 Inz(*Zeros) D RESULTAMNT S 10P 0 Inz(*Zeros) //***********************************************************Main Program /Free Chain QryDate XFXRATES CurRateDS; //Valid Date? IF %Found(XFXRATES); //Valid Currency Symbol Selected? I = %Lookup(QRYCUR:CurListArray); IF I > 0; RATE = CurRateArray(I); RESULTAMNT = RATE * BASEAMNT; ENDIF; ENDIF; *Inlr = *On; Return; /End-Free
RNF7595 The result data structure CURRATEDS does not include a subfield in position 1 for record format FXRATESREC.
Please be so kind as to advise me how to solve the RNF7595 problem as I could like to increase the number of currencies from 2 to 34.
Regards,
Christoff Erasmus
Comment