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



Sorry, Clay, Jerry is right. I was assuming you were asking what would
happen if you'd didn't check for a zero NETPRICE, but you were asking
what your modified code would do if NETPRICE was zero, and, as he said,
GROSSPCT would have whatever value it had before going through this
code.

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
TBriggs2@xxxxxxxxxxx

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Briggs, Trevor
(TBriggs2)
Sent: Monday, June 24, 2013 10:40 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: RE: Preventing a divide by zero error

<SNIP>
I was really wondering what the output would look like if the program
ran through without doing the division.
</SNIP>

The program will crash with a divide-by-zero error.

BTW I wholeheartedly agree with what others are saying - you should
ditch that book. I haven't seen code like that since the System/38!

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
TBriggs2@xxxxxxxxxxx

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Clay B Carley
Sent: Monday, June 24, 2013 10:25 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Preventing a divide by zero error

Thanks to everyone who replied; I will be purchasing some new books
soon, and probably signing up for an online course as well.

As far as the original divide by zero problem, here's the result:

#1. I had my variables backwards in the equation. :) Here's how it
ended up:

0044.00 C EVAL *IN10 = ( NETPRICE = 0 )
0045.00 C N10 EVAL (H) GROSSPCT = GROSSPRFT / NETPRICE

#2. Apparently none of the data running through the program caused a
divide by zero

I was really wondering what the output would look like if the program
ran through without doing the division. I may still enter data in the
table to cause this issue to occur, just because I'm curious.

I looked through the previous chapters again, and the best I can find is

they mention that you can condition a line using indicators. But no
mention of what they actually do to condition the line.

I'm working on the next programming assignment at the end of Chapter 5
right now, and I absolutely agree that this book is not very good.
Thankfully, I didn't pay anywhere near full price for it; I think I
found it on ebay for $15.

Thanks again everyone!
Clay Carley
Sonic.net/ Sonic Telecom

Jon Paris wrote:
Oh good grief! I had never heard of a book by Stanley so I just
figured it was a typo. Learn something new every day <grin>. e.g. a)
There is an RPG book by a "Stanley Meyers" and b) It's not very good.
Just checked it on Amazon and that puppy is expensive - it is also
somewhat ancient as reflected by the "AS/400" in the title.


On 2013-06-23, at 11:15 PM, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
wrote:

It's a completely different book from the Bryan Meyers / Jim Buck
book.
(Stanley Meyers <> Bryan Meyers)

But, I completely agree with the recommendation. Jim & Bryan's book
is
(IMHO) the best book for learning RPG.

On 6/23/2013 7:12 PM, Jon Paris wrote:
The best thing would be for him to get the current version of the
same book. Jim Buck worked with Bryan to significantly update it and
the teach sequence is radically improved. It has probably a 2011 or 2012
publishing date. This is the one
http://www.amazon.com/Programming-RPG-IV-Jim-Buck/dp/1583473556 and at
less than $40 it is a bargain. I don't understand the reviews that rate
it poorly - I have to believe they are for the previous version which
had gotten rather messy. The current version was a total rewrite by the
guy (Jim Buck) who run the most successful IBM i college program going.

The Sorcerers Guide is for when they have finished with this book.


On 2013-06-23, at 3:15 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:

I took it from Clay's response that the book was clear . "...
that
section is there just in case you run into those functions later
on. ...
." In 1998 that was highly likely.

Is a "Sorcerer's guide" a better choice for Clay to learn? Or is
that
aimed at intermediate & advanced students?

http://www.redbooks.ibm.com/redbooks/pdfs/sg245402.pdf



On 6/22/2013 5:12 PM, Jon Paris wrote:
Clay - that represents a very old (very, very old) version of the
RPG IV language and frankly you are doing yourself no favours using that
version to teach yourself the language. Even if a lot of programmers are
still writing code like it was 1998.

Try and find a more up-to-date version - it will be worth the
effort.


On 2013-06-22, at 10:07 AM, Clay B Carley <cbc@xxxxxxxxx> wrote:

Hi Vern and Jon,

I don't see a version or edition on this book, but it is dated
1998.

In chapter 5, they talk about "traditional RPG arithmetic
operations",
but also say that section is there just in case you run into
those
functions later on.

Thanks again to everyone who replied!

Clay Carley

--
Booth Martin
802-461-5349
http://www.martinvt.com
--
This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Jon Paris

www.partner400.com
www.SystemiDeveloper.com




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


Jon Paris

www.partner400.com
www.SystemiDeveloper.com





As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.