IBM SC34-5764-01 Manual page 119

Cics transaction server for vse/esa
Table of Contents

Advertisement

/********************************************************/
/* SAMPLE #1: A portion of CATMOUSE EXEC
/* not divided into segments and written with no
/* indentation, and no comments. This style is not
/* recommended.
/********************************************************/
do forever
call display
pull move
if datatype(move,whole) & move >= 0 & move <=2
then select
when mouse+move > len then nop
when cat > mouse,
& mouse+move >= cat,
then mouse = cat
otherwise
mouse = mouse + move
end
if mouse = hole then leave
if mouse = cat then leave
jump = random(1,spring)
if cat > mouse then do
if cat-jump < 1 then nop
else cat = cat-jump
end
else do
if cat+jump > len then nop
else cat = cat+jump
end
if cat = mouse then leave
end
call display
if cat = mouse then say "Cat wins"
else say "Mouse wins"
exit
This next example is easier to read. It is divided into segments, each with its own heading. The comments
on the right are sometimes called remarks. They can help the reader get a general idea of what is going
on.
Programming Style and Techniques
*/
*/
*/
*/
Chapter 10. Programming Style and Techniques
97

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rexx

Table of Contents