hi
I get "The document for the DATA-INTO operation does not match the RPG variable; reason code 5. " error when I am trying to move the JSON into a DS.
I get the json as a variable in the program. The json validate cleanly when I check it on JSONLint.com. I do not understand mapping error. Any help will be appreciated
data-into takeOnRequest %DATA(myJSON: 'case=convert +
allowmissing=yes +
allowextra=yes +
countprefix=num_')
%PARSER('YAJLINTO');
It only partially complete the datastructure when I view it in debug mode as I get the error
The DS is:
dcl-ds takeOnRequest qualified;
annuityCategory char(50) inz('');
annuityType char(50) inz('');
annuitantType char(50) inz('');
productJurisdiction char(2) inz('');
tableCode char(4) inz('');
packageCode packed(3:0) inz(0);
isAnnuityCompulsory ind inz('0');
paymentDate char(10) inz('');
num_income int(10) inz(0);
dcl-ds income dim(10);
paymentDate char(10) inz('');
dcl-ds purchaseAmount;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
end-ds;
inceptionDate char(10) inz('');
specialQuote ind inz('0');
dcl-ds adjustmentFactor;
value packed(7:6) inz(0);
end-ds;
dcl-ds totalPurchaseAmountInclInterest;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
incomeFrequency packed(2:0) inz(0);
dcl-ds incomeIncreasePattern;
increaseType char(50) inz('');
dcl-ds fixedIncomeIncreaseRate;
value packed(7:6) inz(0);
end-ds;
end-ds;
isFirstPaymentInArrears ind inz('0');
guaranteedTerm packed(3:0) inz(0);
dcl-ds commissionSacrificeRate;
value packed(7:6) inz(0);
end-ds;
dcl-ds annuityCommissionInclVAT;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds grossIncome;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds taxablePortionAmount;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds taxablePortionRate;
value packed(9:6) inz(0);
end-ds;
dcl-ds taxPayable;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds taxRate;
value packed(9:6) inz(0);
end-ds;
dcl-ds netIncome;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds rolePlayers;
dcl-ds payer;
taxStatus char(50) inz('');
ownerRelationship char(50) inz('');
partyReferenceNumber packed(13:0) inz(0);
end-ds;
dcl-ds owner;
partyType char(50) inz('');
partyReferenceNumber packed(13:0) inz(0);
end-ds;
dcl-ds paymentBeneficiary;
partyReferenceNumber packed(13:0) inz(0);
end-ds;
dcl-ds taxPayer;
dcl-ds juristic;
dcl-ds registrationNumber;
country char(2) inz('');
number char(50) inz('');
identifierType char(50) inz('');
end-ds;
dcl-ds taxRateOverrideRate;
value packed(7:6) inz(0);
end-ds;
end-ds;
dcl-ds naturalPerson;
birthDate char(10) inz('');
dcl-ds nationalIdentity;
country char(2) inz('');
number char(50) inz('');
identifierType char(50) inz('');
end-ds;
dcl-ds taxRateOverrideRate;
value packed(7:6) inz(0);
end-ds;
end-ds;
end-ds;
dcl-ds annuitants;
dcl-ds singleLife;
dcl-ds annuitant;
gender char(20) inz('');
birthDate char(10) inz('');
partyReferenceNumber packed(13:0) inz(0);
end-ds;
end-ds;
end-ds;
dcl-ds jointLife;
dcl-ds firstAnnuitant;
gender char(20) inz('');
birthDate char(10) inz('');
dcl-ds paymentReductionRateOnDeath;
value packed(7:6) inz(0);
end-ds;
end-ds;
dcl-ds secondAnnuitant;
gender char(20) inz('');
birthDate char(10) inz('');
dcl-ds paymentReductionRateOnDeath;
value packed(7:6) inz(0);
end-ds;
end-ds;
end-ds;
end-ds;
num_financialAdvisers int(10) inz(0);
dcl-ds financialAdvisers dim(10);
brokerHouseCode char(6) inz('');
brokerCode char(6) inz('');
marketingAdviserCode char(6) inz('');
branchCode char(6) inz('');
correspondence char(1) inz('');
dcl-ds split;
value packed(7:6) inz(0);
end-ds;
end-ds;
end-ds;
The JSON
myJSON =
{
"annuityCategory": "TRADITIONAL_AAAAAAA",
"annuityType": "LIFE",
"annuitantType": "JOINT_LIFE",
"productJurisdiction": "ZA",
"tableCode": "777C",
"packageCode": "135",
"paymentDate": "2020-10-20",
"income": [{
"paymentDate": "2020-10-27",
"purchaseAmount": {
"currency": "ZAR",
"value": 10000000.00
}
}],
"inceptionDate": "2020-11-01",
"specialQuote": true,
"adjustmentFactor": {
"value": "0.017500"
},
"totalPurchaseAmountInclInterest": {
"currency": "ZAR",
"value": "18493753.12"
},
"purchaseAmount": {
"currency": "ZAR",
"value": "18493753.12"
},
"incomeFrequency": 12,
"incomeIncreasePattern": {
"increaseType": "INFLATION_LINKED_PLUS_FIXED_INCOME_INCREASE",
"fixedIncomeIncreaseRate": {
"value": "0.05"
}
},
"isFirstPaymentInArrears": false,
"guaranteedTerm": 5,
"commissionSacrificeRate": {
"value": "1.00"
},
"annuityCommissionInclVAT": {
"currency": "ZAR",
"value": "0.0"
},
"grossIncome": {
"currency": "ZAR",
"value": "64000.00"
},
"taxablePortionAmount": {
"currency": "ZAR",
"value": "64000.00"
},
"taxablePortionRate": {
"value": "0.00"
},
"taxPayable": {
"currency": "ZAR",
"value": "0.00"
},
"taxRate": {
"value": "0.00"
},
"netIncome": {
"currency": "ZAR",
"value": "64000.00"
},
"rolePlayers": {
"payer": {
"taxStatus": "TRUST",
"ownerRelationship": "SAME",
"partyReferenceNumber": "1111111111111"
},
"owner": {
"partyType": "JURISTIC",
"partyReferenceNumber": "2222222222222"
},
"paymentBeneficiary": {
"partyReferenceNumber": "3333333333333"
},
"annuitants": {
"singleLife": {
"annuitant": {
"gender": "FEMALE",
"birthDate": "1963-03-03",
"partyReferenceNumber": 4444444444444
}
}
}
},
"financialAdvisers": [{
"brokerHouseCode": "232323",
"brokerCode": "000011",
"marketingAdviserCode": "abcdef",
"branchCode": "ghijkl",
"correspondence": "N",
"split": {
"value": "0.750000"
}
}]
}
I get "The document for the DATA-INTO operation does not match the RPG variable; reason code 5. " error when I am trying to move the JSON into a DS.
I get the json as a variable in the program. The json validate cleanly when I check it on JSONLint.com. I do not understand mapping error. Any help will be appreciated
data-into takeOnRequest %DATA(myJSON: 'case=convert +
allowmissing=yes +
allowextra=yes +
countprefix=num_')
%PARSER('YAJLINTO');
It only partially complete the datastructure when I view it in debug mode as I get the error
The DS is:
dcl-ds takeOnRequest qualified;
annuityCategory char(50) inz('');
annuityType char(50) inz('');
annuitantType char(50) inz('');
productJurisdiction char(2) inz('');
tableCode char(4) inz('');
packageCode packed(3:0) inz(0);
isAnnuityCompulsory ind inz('0');
paymentDate char(10) inz('');
num_income int(10) inz(0);
dcl-ds income dim(10);
paymentDate char(10) inz('');
dcl-ds purchaseAmount;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
end-ds;
inceptionDate char(10) inz('');
specialQuote ind inz('0');
dcl-ds adjustmentFactor;
value packed(7:6) inz(0);
end-ds;
dcl-ds totalPurchaseAmountInclInterest;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
incomeFrequency packed(2:0) inz(0);
dcl-ds incomeIncreasePattern;
increaseType char(50) inz('');
dcl-ds fixedIncomeIncreaseRate;
value packed(7:6) inz(0);
end-ds;
end-ds;
isFirstPaymentInArrears ind inz('0');
guaranteedTerm packed(3:0) inz(0);
dcl-ds commissionSacrificeRate;
value packed(7:6) inz(0);
end-ds;
dcl-ds annuityCommissionInclVAT;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds grossIncome;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds taxablePortionAmount;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds taxablePortionRate;
value packed(9:6) inz(0);
end-ds;
dcl-ds taxPayable;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds taxRate;
value packed(9:6) inz(0);
end-ds;
dcl-ds netIncome;
currency char(3) inz('');
value packed(15:2) inz(0);
end-ds;
dcl-ds rolePlayers;
dcl-ds payer;
taxStatus char(50) inz('');
ownerRelationship char(50) inz('');
partyReferenceNumber packed(13:0) inz(0);
end-ds;
dcl-ds owner;
partyType char(50) inz('');
partyReferenceNumber packed(13:0) inz(0);
end-ds;
dcl-ds paymentBeneficiary;
partyReferenceNumber packed(13:0) inz(0);
end-ds;
dcl-ds taxPayer;
dcl-ds juristic;
dcl-ds registrationNumber;
country char(2) inz('');
number char(50) inz('');
identifierType char(50) inz('');
end-ds;
dcl-ds taxRateOverrideRate;
value packed(7:6) inz(0);
end-ds;
end-ds;
dcl-ds naturalPerson;
birthDate char(10) inz('');
dcl-ds nationalIdentity;
country char(2) inz('');
number char(50) inz('');
identifierType char(50) inz('');
end-ds;
dcl-ds taxRateOverrideRate;
value packed(7:6) inz(0);
end-ds;
end-ds;
end-ds;
dcl-ds annuitants;
dcl-ds singleLife;
dcl-ds annuitant;
gender char(20) inz('');
birthDate char(10) inz('');
partyReferenceNumber packed(13:0) inz(0);
end-ds;
end-ds;
end-ds;
dcl-ds jointLife;
dcl-ds firstAnnuitant;
gender char(20) inz('');
birthDate char(10) inz('');
dcl-ds paymentReductionRateOnDeath;
value packed(7:6) inz(0);
end-ds;
end-ds;
dcl-ds secondAnnuitant;
gender char(20) inz('');
birthDate char(10) inz('');
dcl-ds paymentReductionRateOnDeath;
value packed(7:6) inz(0);
end-ds;
end-ds;
end-ds;
end-ds;
num_financialAdvisers int(10) inz(0);
dcl-ds financialAdvisers dim(10);
brokerHouseCode char(6) inz('');
brokerCode char(6) inz('');
marketingAdviserCode char(6) inz('');
branchCode char(6) inz('');
correspondence char(1) inz('');
dcl-ds split;
value packed(7:6) inz(0);
end-ds;
end-ds;
end-ds;
The JSON
myJSON =
{
"annuityCategory": "TRADITIONAL_AAAAAAA",
"annuityType": "LIFE",
"annuitantType": "JOINT_LIFE",
"productJurisdiction": "ZA",
"tableCode": "777C",
"packageCode": "135",
"paymentDate": "2020-10-20",
"income": [{
"paymentDate": "2020-10-27",
"purchaseAmount": {
"currency": "ZAR",
"value": 10000000.00
}
}],
"inceptionDate": "2020-11-01",
"specialQuote": true,
"adjustmentFactor": {
"value": "0.017500"
},
"totalPurchaseAmountInclInterest": {
"currency": "ZAR",
"value": "18493753.12"
},
"purchaseAmount": {
"currency": "ZAR",
"value": "18493753.12"
},
"incomeFrequency": 12,
"incomeIncreasePattern": {
"increaseType": "INFLATION_LINKED_PLUS_FIXED_INCOME_INCREASE",
"fixedIncomeIncreaseRate": {
"value": "0.05"
}
},
"isFirstPaymentInArrears": false,
"guaranteedTerm": 5,
"commissionSacrificeRate": {
"value": "1.00"
},
"annuityCommissionInclVAT": {
"currency": "ZAR",
"value": "0.0"
},
"grossIncome": {
"currency": "ZAR",
"value": "64000.00"
},
"taxablePortionAmount": {
"currency": "ZAR",
"value": "64000.00"
},
"taxablePortionRate": {
"value": "0.00"
},
"taxPayable": {
"currency": "ZAR",
"value": "0.00"
},
"taxRate": {
"value": "0.00"
},
"netIncome": {
"currency": "ZAR",
"value": "64000.00"
},
"rolePlayers": {
"payer": {
"taxStatus": "TRUST",
"ownerRelationship": "SAME",
"partyReferenceNumber": "1111111111111"
},
"owner": {
"partyType": "JURISTIC",
"partyReferenceNumber": "2222222222222"
},
"paymentBeneficiary": {
"partyReferenceNumber": "3333333333333"
},
"annuitants": {
"singleLife": {
"annuitant": {
"gender": "FEMALE",
"birthDate": "1963-03-03",
"partyReferenceNumber": 4444444444444
}
}
}
},
"financialAdvisers": [{
"brokerHouseCode": "232323",
"brokerCode": "000011",
"marketingAdviserCode": "abcdef",
"branchCode": "ghijkl",
"correspondence": "N",
"split": {
"value": "0.750000"
}
}]
}
Comment