× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You aren't moving another value into the field, you are trying to do math on the field. If you don't initialize the data structure or field in some way, then by default the entire data structure contains blanks. Even the numeric fields. You add blanks to a number. That is giving you your decimal data error. https://www.itjungle.com/2009/02/25/fhg022509-story02/

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Jason Olson
Sent: Thursday, March 21, 2019 8:29 AM
To: RPG programming on IBM i
Subject: Re: Interesting issue when testing a printed report.

Your code sample you provided works because you set NumFld to a specific value. In my case I was trying to move a value from one field into another.

Here is my DS,

dcl-ds Total1
likerec(Print.TOTAL1:*output);

Here is the code in the program,

Total1.TAXTOTAL += StateTax(i).TAX_AMOUNT;

Earlier in the program I have to code this,

Total1.TAXTOTAL = 0;

If I don't have that in the code then when I try to run I will get a data decimal error. The error is on the line where I'm setting the TAXTOAL like I have above.


Thanks,

Jason E. Olson
IBM i Engineer/Developer
josys36@xxxxxxxxx
480.223.2952


On Wed, Mar 20, 2019 at 4:29 PM Brian Parkins <goodprophet.bp@xxxxxxxxx>
wrote:

I think we need to see a little of your coding to help, Jason. How are
you defining your Data Structures? Are they defined internally, within
the program - or externally defined?

The following basic example works just fine for me:

DDS:
A R AAFORMAT SPACEB(1)
A 43'Test of Printer File with
D/Str Fo-
A rmats'
A SPACEB(1)
A CHARFLD 20O 21SPACEB(3)
A NUMFLD 9 2 57

RPG IV:
**Free
Dcl-F AAPrtf Printer;

Dcl-DS PrtfDS Extname('AAPRTF':'AAFORMAT':*Output);
End-Ds;

CharFld = 'First Record';
NumFld = 12345.7;

Write AAFormat PrtfDS;
*InLR = *On;
Return;

Getting sight of your code might help us to isolate your problem.
Brian.

On 20/03/2019 18:38, Jason Olson wrote:
So the last few days I've been working on creating a printed report.
Normally I just create spreadsheets and email those, but in this
case,
they
wanted a printed report emailed as a PDF.

So I created a report like normal, but as I create programs with
MAIN procedures, I needed to create data structures for each record
format in the print file. All of the fields in the print file are
reference fields except a field that will hold a total. That is
defined as a 9 byte zoned field with 2 decimal places. What is
strange is when I go to set this
field
to a value in my program. If I set it to a value like 0 everything
works normally. However, if I try to move a value into it like from
another field, I get a data decimal error. The only way I was able
to get things
to
work normally is if I set the field in the data structure to 0
before
using
it. I haven't ran into this before, so I figured I would ask the
group if someone had seen this.



Thanks,

Jason E. Olson
IBM i Engineer/Developer
josys36@xxxxxxxxx
480.223.2952

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a
message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.