Language CLLE
(AS400 Control Language)
Date: | 03/25/08 |
Author: | Tony Cellana |
URL: | n/a |
Comments: | 0 |
Info: | http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp?topic=/pdf_table/launcher.htm |
Score: | (2.67 in 3 votes) |
/******************************************************************************/ /** 99 Bottles of Beer on the Wall. **/ /** Written by Tony Cellana **/ /******************************************************************************/ PGM /** Declare Variables **/ DCL VAR(&IDX) TYPE(*DEC) LEN(2 0) VALUE(99) DCL VAR(&IDXA) TYPE(*CHAR) LEN(2) DCL VAR(&MSG1) TYPE(*CHAR) LEN(80) DCL VAR(&MSG2) TYPE(*CHAR) LEN(80) LOOP: DO /** Convert Numeric to Alpha **/ CHGVAR VAR(&IDXA) VALUE(&IDX) /** Load Verse Line 1 **/ CHGVAR VAR(&MSG1) VALUE(&IDXA || ' bottles of beer + on the wall, ' || &IDXA || ' bottles of + beer.') /** Decrement Index **/ CHGVAR VAR(&IDX) VALUE(&IDX - 1) /** Convert Numeric to Alpha **/ CHGVAR VAR(&IDXA) VALUE(&IDX) /** Load Verse Line 2 **/ CHGVAR VAR(&MSG2) VALUE(' Take one down and pass + it around, ' || &IDXA || ' bottles of beer.') /** Send Verse to Display **/ SNDPGMMSG MSG(&MSG1) TOPGMQ(*EXT) SNDPGMMSG MSG(&MSG2) TOPGMQ(*EXT) SNDPGMMSG MSG(' ') TOPGMQ(*EXT) /** Time to Leave? **/ IF COND(&IDX = 1) THEN(GOTO CMDLBL(LAST)) /** Do it again, WHEE, Do it again **/ GOTO CMDLBL(LOOP) ENDDO /** One Last Time **/ LAST: CHGVAR VAR(&MSG1) VALUE('1 bottle of beer on the + wall, 1 bottle of beer.') CHGVAR VAR(&MSG2) VALUE(' Take one down and pass + it around, no more bottles of beer on the + wall.') SNDPGMMSG MSG(&MSG1) TOPGMQ(*EXT) SNDPGMMSG MSG(&MSG2) TOPGMQ(*EXT) SNDPGMMSG MSG(' ') TOPGMQ(*EXT) CHGVAR VAR(&MSG1) VALUE('No more bottles of beer on + the wall, no bottles of beer.') CHGVAR VAR(&MSG2) VALUE(' Go to the store and buy + some more, 99 bottles of beer on the wall.') SNDPGMMSG MSG(&MSG1) TOPGMQ(*EXT) SNDPGMMSG MSG(&MSG2) TOPGMQ(*EXT) /** Bye, Y'all, See Ya Reall Soon **/ ENDPGM: ENDPGM RETURN
Download Source | Write Comment
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments