Coding style – IBM SC34-5764-01 User Manual

Page 118

Advertising
background image

This gives the trace:

rotate

6 *-*

wheel:

8 *-*

cog:

10 *-*

true:

8 *-*

cog:

10 *-*

true:

8 *-*

cog:

10 *-*

true:

6 *-*

wheel:

8 *-*

cog:

13 *-*

false:

8 *-*

cog:

13 *-*

false:

8 *-*

cog:

13 *-*

false:

17 *-* done:

v

To see how the language processor is computing expressions, use TRACE Intermediates.

v

To find out whether you are passing the right data to a command or subroutine, use TRACE Results.

v

To make sure that you get to see nonzero return codes from commands, use TRACE Errors.

Coding Style

The only sure way of finding out whether a program is correct is to read it. Therefore, programs must be
easy to read. Naturally, easy to read means different things to different programmers. All we can do here is
to give examples of different styles, and leave you to choose the style you prefer.

A very good way to get your program checked is to ask a fellow worker to read it. Be sure to choose a
coding style that your fellow workers find easy to read.

Most people would find the following program fragment difficult to read.

/* ROTATE EXEC

*/

/* Example:

two iterations of wheel, six iterations */

/* of cog.

On the first three iterations,

"x < 2"

*/

/* is true. On the next three, it is false.

*/

trace L
do x = 1 to 2
wheel:

do 3

cog:

if x < 2 then do

true:

end
else do

false:

end

end

end
done:

Figure 47. ROTATE EXEC

Programming Style and Techniques

96

CICS TS for VSE/ESA: REXX Guide

Advertising