IT:99 Bottles of Beer (DCS)
From Stiki
This DCS code will output the song lyrics to the DCS run log. Note that if there is an input file the main code (excluding the variable declarations) should be placed within a block of the form IF FIRST_RECORD THEN ... ENDIF to ensure that the lyrics appear only once per program run (rather than once for each record in the input file). If there is no input file, do not apply this conditioning as FIRST_RECORD will be false if there is no input file.
; "99 Bottles of Beer" for DCS ; by Stelio Passaris ; http://stelio.net/stiki/99BoB ; DCS is the Data Conversion System for the actuarial modelling software ; Prophet, which is part of Sungard's iWorks system. ; Variable declaration: EXPLICIT_DECLARATIONS COUNTER AS INTEGER BOTTLES AS INTEGER PLURAL AS TEXT ; Output song lyrics for bottle 99: MESSAGE("99 bottles of beer on the wall,") MESSAGE("99 bottles of beer.") FOR COUNTER FROM 1 TO 98 ; The step value in the FOR...NEXT loop can only be positive, so ; derive the number of bottles by subtraction: BOTTLES = 99 - COUNTER ; Derive whether to pluralise "bottle" based on the number of bottles: IF BOTTLES = 1 THEN PLURAL = "" ELSE PLURAL = "s" ENDIF ; Output song lyrics for bottles 98 to 1: MESSAGE("Take one down and pass it around,") MESSAGE(STRVAL(BOTTLES) + " bottle" + PLURAL + " of beer on the wall.") MESSAGE("") MESSAGE(STRVAL(BOTTLES) + " bottle" + PLURAL + " of beer on the wall,") MESSAGE(STRVAL(BOTTLES) + " bottle" + PLURAL + " of beer.") NEXT ; Finish off the song lyrics: MESSAGE("Take it down and pass it around,") MESSAGE("No more bottles of beer on the wall.")

