To change the spooled file to different output queue, just
specify the other output queue's name (and library)

Option 3 on the Work with Objects Using PDM screen will
not work for you. It copies by creating a duplicate object, for
which you need security authority, which you do not have. Instead,
use option 15 = Copy file

You don't have comments? How do you know what you mean?
If you can't explain it, how can you code it?

See RPG544LIB/QRPGLESRC.STANDARDS member for guidelines on
writing programs and useful compiler directives.

business arithmetic notes:

RPG does decimal arithmetic.

numeric fields on iSeries are most efficient with odd
numbered lengths

Store intermediate values in a multiple step calculation
with sufficient high order digits and decimal positions.

A series of multiplication and division operations, in
theory, can be done in any order. In practice, is best to do
all multiplication first because it always results in a
determinate number of significant/decimal positions. Ensure
result does not experience low order truncation. e.g. 12.34
* 56.78 = 700.6652, not 700.66.

Do the division last if you can. It can easily result in
an indeterminate number of decimal positions which, in
intermediate calculations, can lead to loss of accuracy
problems.

Do not round any result until you are computing the final
dollars & cents value. RPG calls rounding "Half Adjust".

Do not round unnecessary. The compiler will issue a
warning message in these cases. Clean up your code.

Customize your PDM user options (the two letter commands, e.g.
DM)

Default PDM User Options are stored in file QAUOOPT in
library QGPL. You will need your own copy of this file.

CPYF FROMFILE(QGPL/QAUOOPT) TOFILE(*CURLIB/QAUOOPT)
CRTFILE(*YES)

Your PDM profile defaults to use the QAUOOPT file in the
QGPL library for user options. You need to change that to
point to the file you just created in your library.

Start a PDM session, e.g. WRKOBJPDM.

Use F18 (CHANGE DEFAULTS) to change the option file
library from QGPL to your regular library, i.e. same as
your UserID. (one time only)

Use F16 when ever you want to change or add new user
options to quickly run a command. For example,

option Q to run default query against a file name
RUNQRY QRY(*NONE) QRYFILE((&L/&N))
OUTTYPE(*DISPLAY)

option CL to change your current library to the PDM
library
CHGCURLIB CURLIB(&L)

option SD to start a debug session with a program
? STRDBG PGM(&L/&N) UPDPROD(*YES)

The first two messages messages can safely be ignored. You
will see them frequently. They are warning messages with Severity
(SV) 00. The last msg has a Severity of 40. This prevents a
successful compile.

RNF7066: The record format name of a file is not always used in
RPG programming. Often, just the file name is sufficient. RNF7086:
get used to this msg. Blocking is rarely an issue. RNF7023: you
forgot to EVAL *INLR = *ON

Msg id = message identifier

Sv = severity where

00 or 10 is a warning

20 is a serious warning which may prevent a
successful compile and

30 or more is an error which will prevent a
successful compile

Statement is the SEU or compiler line number of the
code in error. (Unfortunately, the number is not shown with a
decimal point as in SEU. Compile statement number 012300 is
SEU's 123.00 line number.)

To direct the compiler to show SEU line numbers in its error
messages, include the compiler directive, OPTION(*SRCSTMT), in
the H spec at the top of your RPG program

Syntax errors

SEU will find most

Pay attention to highlighted errors

use F4 to prompt for specification's input format

Compile errors

The system will send a message telling you if your
compile was successful or not. The PDM user option, DM
(DSPMSG), shows your messages. If the compile was
successful, you should still review the compile for warning
messages. Msg RNF7086 can be safely ignored.

The PDM user option, SP (WRKSPLF), shows your spooled
compile listing and, if there are errors, a job log.
However, there is an easier way to review a compile …

The next time a compile fails, enlist SEU's editor to help
you find the errors.

start SEU in edit mode and

press F15 for Browse/Copy options, then

select option 2 to access the compiler spool file.

the SEU panel splits into two halves. The upper half still
shows the source member in edit mode, while the bottom half
shows the compiler listing in browse mode.

Move the cursor to the SEU command line in the bottom
half, and execute the F (find) command to locate the first
error:

SEU==> F *ERR

SEU displays the first line in the compiler listing with
an error, and displays the error message at the bottom of
the screen. You can move the cursor to the message and press
Help (F1) to get cause and recovery information about
the error message -- this is the second level text
optionally printed in a compile listing. Some messages are
shown at the line of code in error. Some are shown at the
end of the compile listing with a reference to the line
number in error.

To fix the problem that caused the error message, move the
cursor to the upper half of the screen and make your
corrections. Then, move the cursor to the bottom half and
press F16 to find the next compiler error message.
Continue this process until you reach the last compiler
error. (You might have to skip quite a few warning
messages.) Then press F12 to go back to full-screen edit
mode. To find a specific error message (such as 7030, which
informs you of undefined variables), use the command:
SEU==> F '*RNF7030'

This technique works with all types of source code, not
just with RPG. You can use it just as easily in CL programs,
Cobol programs, display file DDS, command source, and so on.

Problem Solving

'Insanity is doing the same thing over and over again and
expecting different results'- Albert Einstein

Look at your class notes. It may jog your memory about a
concept you thought important enough to write down. You didn't
write it down? Promise yourself you will make more notes.

RTFM. About half the questions I get are already answered in
the textbook, on my web pages, in the lab or assignment
specifications, and in my notes and examples in the course
library's CHAPnnDEMO source files. If you have not read this
material at least TWICE, you have not really read it. There is a
50/50 chance you can solve the problem yourself in minutes just
by rereading the material.

The iSeries will help if you put the cursor on the msg and
press F1. When fixing compile errors, use SEU's "F *ERR" command
to find errors and use F1. Use DSPJOBLOG to investigate run time
errors. (A significant part of what I know about the iSeries was
learned just by doing this.)

leave the problem alone for a while and come back later. A
good night's sleep is often the best help you can give yourself.
After midnight, problems can take hours to solve. In the
morning, they usually take minutes.

show a colleague your problem. Another pair of eyes can often
spot the problem. Even experienced programmers sometimes need
someone else to look at their code. Also, explaining things out
loud to someone else can often reveal the problem's cause.
(Thinking too much can result in infinite loops.)

when testing your logic, make one change at a time and
re-test. Making too many changes at once can complicate
debugging. When you are all done, re-test everything to make
sure a fix did not "unfix" something else.

PRINT the CURRENT COMPILE listing of your program (and
screens) and bring it to me during help time with the problem
code/messages highlighted. It should be commented.

send me email and put the relevant spooled files in
the PROBLEMS outq located in the RPG544TM Library. (Change the
spool file's output queue in the same way that you change it to
PRT01 to print it on paper.)

In your email:

cut and paste the error message(s) from the compile or
screen,

cut and paste the line(s) of code in error and enough
lines before/after those lines to give me some context, and

tell me what you did to try to fix it. What does not make
sense to you? Why do you think it should work (even though
the system has a different opinion)?

Be careful about your email program automatically wrapping
long lines when sending the msg -- do not allow it to do
this -- it makes reading code very difficult.

Try to give me enough information to comment on your
problem without having to view your listing in the
RPG544TM/PROBLEMS outq -- it saves me time. However, putting
the listing there saves us both time if I need to look at
the whole compile or program output. Your program must be
commented or I may just give up trying to figure it out.
After we have solved the issue, please delete your spool
files from PROBLEMS.

"Please tell me why my program will not compile/work" is NOT a
good way to ask for help. As a professor, I do not debug students'
programming problems. That is your job. My job is to help you do
your job.

After you have signed on, examine the spooled file containing
your last job log – it will tell you what the problem was. Prompt
the CHGPRF command with F4 and change your profile settings as
needed. Then sign off and try to sign on again normally.

PROBLEM 2:

I still cannot sign on!

If you see this message displayed on the sign on screen:

CPF1394 User profile DCnnnxnn cannot sign on

it is because someone has disabled your profile -- probably
because you have been running too many infinite loop jobs. (Better
you cannot work than everyone cannot work.) Learn about using the
System Request key to cancel a program that will not end. Never
just close the terminal window. Please see your instructor who
can reset your profile.

PROBLEM 3:

But I still cannot sign on!

The issue may be with your library. Have your instructor
temporarily remove all references to your library from your
profile: initial program, menu, MSGQ, OUTQ.

Other Problems

By the way, NEVER give someone else your password so they can
look at your code in your library -- not even a professor. It
breaks our computer
use guidelines.

If any of these things happen to you:

"error found on STRSEU command" when you try to edit a member

cannot compile anything

the compile works but says it cannot create a program
object...see job log. The job log has a message: Storage limit
overflow for user profile Dx544s99.

no compile listing is found after compiling something

you change your spooled file to PRT01 but it just sits in the
queue

then your profile has probably used up its maximum space
allocation. Run DSPUSRPRF on your user id and check your usage.

Most of the space is likely occupied by old compile objects kept
in a library called QRPLOBJ (replaced objects). The system keeps
these because of the high security level we use on this iSeries.
QRPLOBJ is cleaned out at each IPL but if you do a lot of
compiles, your space limit may be exceeded before then. (IPL =
Initial Program Load = reboot)