99 Bottles of Beer (using REXX)

From Try-AS/400
Jump to navigation Jump to search
Qsicon Fixme.png This article isn't finished yet or needs to be revised. Please keep in mind that thus it may be incomplete.

Reason: Rephrase, reformat, set links and wade out unneccessary stuff.

Heiko knows Rexx from his OS/2 days and wanted to run "99 bottles of beer" as his first project.

Preparations

Things you need:

Create the script file

The next step creates a member named BOTT[2] in source file BOTTLES that is stored in library HKRETSCHME.

Work with the BOTTLES file:

WRKMBRPDM FILE(HKRETSCHME/BOTTLES)

or…

WRKMBRPDM FILE(HKRETSCHME/BOTTLES) MBR(BOTT)

…if you already created the BOTT member (=script object in BOTTLES source file).

Project99BottlesWRKPDM.png

Create the member BOTT: Hit F6[3] to bring up the options of STRSEU:

Project99BottlesSTRSEU.png

Insert the code:

Project99BottlesSEU.png

Save the member by entering "Y" (here "J") in the first line.

Project99BottlesSEUSave.png

Run it

STRREXPRC SRCMBR(BOTT) SRCFILE(BOTTLES)

Project99BottlesSTRREXPRC 01.png

Project99BottlesSTRREXPRC 02.png

Weblinks

References

  1. 99BOTTLES would have been nice, but filenames are not allowed to begin with numbers. Maybe NTYNBTLS would be a good alternate name?
  2. Members cannot have the same name as the physical source file (BOTTLES). Therefore the member is named BOTT.
  3. Alternatively use the STRSEU command.