Voting

Category

real language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language Model 204

Date:04/20/05
Author:Kevin Giles
URL:n/a
Comments:5
Info:n/a
Score: (3.00 in 35 votes)
*Model 204 (or M204 as it's commonly called) is a proprietary
*database and language of Computer Corporation of America.
*It was first developed over 30 years ago by the NSA.
*Some claim that it's the fastest IBM Mainframe database.
*It is good for databases with large record counts.
*The Department of Social Security of Australian employs
*hundreds of M204 programmers.
*Add-on packages permit SQL and Web access.
*
* Written by Kevin Giles, NCI Information Systems Inc.
* e-mail: KGILES@USGS.GOV
*
* 100 bottles of beer / take one / action
*
*LOWER
BEGIN
DECLARE %S IS STRING LEN 1 COMMON
FOR %BOTTLE FROM 100 TO 0 BY -1
  CALL CHECKPLURAL(%BOTTLE)
  PRINT %BOTTLE AND 'bottle' WITH %S AND 'of beer on the wall.'
  PRINT %BOTTLE AND 'bottle' WITH %S AND 'of beer.'
  PRINT 'Take one down, pass it around.'
  CALL CHECKPLURAL(%BOTTLE-1)
  IF %BOTTLE-1 = +0 THEN PRINT 'No bottles of beer on the wall.'
      SKIP 1 LINE
      PRINT 'No bottles of beer on the wall.'
      PRINT 'No bottles of beer.'
      PRINT 'Go to the store, buy some more.'
      %BOTTLE = 101
      CALL CHECKPLURAL(%BOTTLE-1)
  END IF
  PRINT $UNBLANK(%BOTTLE-1) AND 'bottle' WITH %S AND -
                     'of beer on the wall.'
  SKIP 1 LINE
END FOR
SUBROUTINE CHECKPLURAL (%PASSVAL STRING DP 0 INPUT)
  IF %PASSVAL NE +1 THEN  %S = 's'
  ELSE                    %S = ''
  END IF
END SUBROUTINE
END

Download Source | Write Comment

Alternative Versions

Comments

>>  John Bowman said on 11/10/06 00:05:51

John Bowman "It was first developed over 30 years ago by the NSA."

Wouldn't it be more correct to say that "It was first developed over 30 years ago for the NSA."

>>  Rob said on 04/12/08 06:50:07

Rob 30 years ago from when? According to wikipedia article, it was first deployed in 1972.

>>  Neal said on 04/19/08 19:05:18

Neal Yes, Model204 was first developed for NSA going back to 1968. It was not called Model204 until later, just before it was commercially released. It was developed as part of the Intelligence Data Handling Systems/Modular Operating Disk Systems Project (IDHS/MODS).

>>  Kevin Giles said on 07/03/08 19:20:56

Kevin Giles I am the author of this Model 204 code, and I'm disappointed to see that this code has an issue:
The statement
DECLARE %S IS STRING LEN 1 COMMON
must also exist within the subroutine.
Please correct it.
Thanks.

>>  Gary Thompson said on 01/27/09 01:34:33

Gary Thompson I am not an M204 coder but normally it would be more efficient to set %S to 's' initially then use the code IF %PASSVAL EQ +1 THEN %S = '' in the subroutine. Thus %S is updated twice as apposed to 100 times in the current code. Important if code is being repeated millions of times.

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!

Name:

eMail:

URL:

Security Code:
  
Comment: