× 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.



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


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.