AS/400

AS/400

Last update: 26/07/2001

Introduction

As an AS/400 programmer I have written many nice and interesting programs over the years.
I have decided to share some of these programs with the rest of the world.
Hopefully you will find them interesting also and of use.
All program sources are conveniently stored as textfiles, but also as a savefile (version 3.2 for compatibility).
There is a readme included that explains how to transfer the savefile to your AS/400 using FTP.
I did not include any binaries, so you need to have a RPG-compiler to compile the sources.
Please let me know what you think of my programs; it may encourage me to share some more in future.
Also any remarks or suggestions are more than welcome.
You can contact me at:
freesoftware[at]xs4all.nl

Calendar

Already some time ago I wrote a small CL program that can calculate the weekday and Gregorian weeknumber for any date from the year 1 onwards.
Later I wrote a tool around this program that will present you an eternal calendar with the possibility to add notes for each day.
Actually the notes are kept by user id, so it is multi-user capable also!
The zipfile will contain a screenshot, so you can already see what it will look like.
Remember that all I'm offering is freeware, so even if you don't like the program, you are still permitted to use parts of it for you're own convenience!
Since the calender calculation is in CL, offcourse the performance would be much better if rewritten and integrated into the RPG program, but this way the tool can be used for other purposes.
Here it is:
calendar.zip
Update 05/04/2001: Latest version (1.1) contains the following extra features:
* Added highlights for dates with to-do items
* Weekend dates have different color from weekdays

Clock

A colleague of mine once wrote a small program that displays a digital clock on your screen with big numbers.
I had already changed it so that it would update automatically every second (added seconds on the display also), but later I decided that making an analogue clock was much more of a challenge!
After making the analogue clock I optimized the code for the digital one, and added it to the program, so that you can switch between the two kinds of clocks.
Also the program allows you to change the colors from the command line.
As a bonus I added an alarm feature!
Curious? Download the code + a screenshot here:
clock.zip

Yahtzee!

OK, now for the fun part! :-)
Yahtzee is a dice game, and probably you know it already (maybe by a different name).
The rules are quite simple: you have 5 dices, and 3 throws. The objectives are to score as many points as possible in a total of 13 turns. For each turn you have to add your score to a category.
For instance the first 6 categories are for throwing as many 1's, 2's etc. as possible.
After each throw you are allowed to hold as many dices you want, and throw the remaining dices to collect more. After the 3rd throw you have to select the category.
For instance: on the first throw you score 4-2-3-5-2, so you decide to collect the 2's. You hold the second and 5th dice and throw again. Now you throw the remaining 3 dices and the score becomes 2-2-4-6-2. You additionally hold the first dice and throw again to get 2-2-2-3-2. Now you select the 2-category and obtain 4x2=8 points.
Besides these 6 categories there are 7 special categories:
* 3 of a kind - which is 3 alike + 2 others - you will obtain the sum of all dices in points,
* 4 of a kind - simular to 3 of a kind, but with 4 alike,
* Full house - 3 alike + 2 alike - 25 points,
* 4 in a row - e.g. 1-2-3-4 or 2-3-4-5 or 3-4-5-6 - 30 points,
* 5 in a row - e.g. 1-2-3-4-5 or 2-3-4-5-6 - 40 points,
* Yahtzee - 5 of a kind - 50 points,
* Chance - any combination - will give you the sum of all dices in points.
There are bonus points if you score more than 63 points total on the first 6 categories (35 points extra), and for each additional Yahtzee after the first one you will receive 100 bonus points.
The program keeps a highscore list of the top-10 scores by user id!
There is a (quite simple) cheat in this program, but I suggest you don't use it, or you will miss the fun part.
Wanna play? Start by clicking this link:
yahtzee.zip
Update 05/04/2001; Version 1.1:
* When using the cheat function a nice little message will be displayed
* You will get punished for using the cheat (no highscore)
Update 20/04/2001; Version 1.11:
* Fixed some minor bugs
* Made the cheat-mode optional by setting a flag in the INIT routine
* Added input check for the Hold fields

Snake

And yet another game!
Snake is a program that still has several items on the to-do list, but I didn't want you to miss it!
The idea is that you have to control a snake that is trapped in a box. It moves around, and you have to prevent it from bumping into walls and from biting it's own tail.
The problem is: the box is quite small, and the snake keeps getting longer and longer...
You get the picture, and if you like it look over here:
snake.zip
Update 05/04/2001; Version 1.1:
* Added support for use of the arrow keys on the Numpad (2, 4, 6, 8)
Update 18/04/2001; Version 1.2:
* Disabled the possibility to switch to the opposite direction (this would always kill the snake)
* Input is now only allowed via the numpad; not via F-keys anymore
Update 20/04/2001; Version 1.3:
* Now it's really a game! Added points counter, random bonus items, highscore list and game over message :-)
Update 27/04/2001; Version 1.4:
* Added some colors to the snake and the bonus items
* Fixed a small bug that caused the game to be over when it was not even started!

Train

NEW! - added 05/04/2001
This is a nice program you can put into someone's startup program.
When the user logs on a train will ride on the screen and 'steal' the IBM copyright line!
Also a command is included that will enable you to ride the train remotely on someone's sign-on screen using his or hers device id.
Ofcourse it's just a prank, but it will also teach you how to control multiple devices:
train.zip

Hexcolors

NEW! - added 05/04/2001
Not really related to AS/400 programming, but I was just looking for a nice color to spice up some tables, so I made a little program that outputted the HTML for displaying almost 5.000 different colors with their RGB values in a table.
The nice thing is that it is using an internal described file in order to output the long text lines.
For old school programmers this is a piece of cake, but it took me some time figuring it out.
The output result is an HTML file of 347Kb, and can be found
here
The code, and the HTML zipped is a lot smaller (only 35Kb) and can be downloaded here:
hexcolor.zip

Pacman

NEW! - added 20/07/2001
My best game up to now!
I Don't think I need to explain how the game is played. Thoughest part is that in the current version you have only 1 life.
I also expect to expand the number of different levels in the future.
The monsters don't seem so smart at first, but wait untill you have to deal with 5 of them.
I'm aware of some bugs, but that will be fixed shortly.
Download this game
here
Update 24/07/2001; Version 1.1:
* Many changes and bugfixes a.o. more lives, bonusses etc.

Tetris

NEW! - added 26/07/2001
Now that I really got the hang of it I decided it was time to make tetris!
Already some time ago I download a version of this game for AS/400 from the as400 network, but this version could not satisfy me because it had some bugs, and I really couldn't figure out the code.
Not that my code is easy to understand, but at least I know what it does ;-)
Also in my opinion this version has better gameplay, more features, and the code is really small (only 800 lines of RPG including remarks).
Download this game
here