Voting

Category

assembly language

Bookmarking

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

Language Assembler (System/370)

Date:04/20/05
Author:R. Heemskerk
URL:n/a
Comments:5
Info:n/a
Score: (3.15 in 40 votes)
* 99 bottles of beer
* Assembler program for IBM System/370 (and up)
* (c) R. Heemskerk, systeemprogrammeur@zonnet.nl
* The program expects a sequential output dataset allocated to ddname OUTDD, FB80
BOTTLE99 CSECT
         SAVE  (14,12),,BOTTLE99
         LR    12,15
         USING BOTTLE99,12
         LR    11,13
         CNOP  0,4
         BAL   13,START
         DC    20A(0)
START    ST    13,8(11)
         ST    11,4(13)
         OPEN  (OUTFILE,(OUTPUT))
         MVI   EXTRA1,C's'
         MVI   EXTRA2,C's'
         LA    4,99
LOOP     CVD   4,DEC
         MVC   CNVNUM,MASK
         ED    CNVNUM,DECNUM
         MVC   OUTNUM1,CNVNUM+2
         MVC   OUTNUM2,CNVNUM+2
         CL    4,=F'1'
         BNE   PUT
         MVI   EXTRA1,C' '
         MVI   EXTRA2,C' '
PUT      PUT   OUTFILE,OUTLINE1
         PUT   OUTFILE,OUTLINE2
         BCT   4,LOOP
         PUT   OUTFILE,OUTLINE3
         PUT   OUTFILE,OUTLINE4
DONE     CLOSE OUTFILE
EXIT     L     13,4(13)
         RETURN (14,12),RC=0
CNVNUM   DS    XL4
MASK     DC    X'40202120'
DEC      DS    0D
         DS    XL6
DECNUM   DS    XL2
OUTLINE1 DC    CL80' '
         ORG   OUTLINE1
OUTNUM1  DS    CL2
         DC    C' bottle'
EXTRA1   DC    C' '
         DC    C' of beer on the wall, '
OUTNUM2  DS    CL2
         DC    C' bottle'
EXTRA2   DC    C' '
         DC    C' of beer.'
         ORG   OUTLINE1+80
OUTLINE2 DC    CL80'Take one down, pass it around.'
OUTLINE3 DC    CL80'No more bottles of beer on the wall, no more bottleX
               s of beer.'
OUTLINE4 DC    CL80'Go to the store and buy some more.'
OUTFILE  DCB   DSORG=PS,DDNAME=OUTDD,MACRF=(PM)
         LTORG
         END

Download Source | Write Comment

Alternative Versions

Comments

>>  ramesh said on 10/27/05 08:49:24

ramesh i need how to conctenate tree strings(firstname Middlename lastname
please mail me. my mail id:rmsh_raju@yahoo.com

>>  Peyton said on 08/23/06 04:55:07

Peyton Nice. I'll have to get out my Green Card, er Yellow Card, er Pink Booklet, er whatever -- seems that this is a good candidate for BXLE and EDMK, but it has been fourteen years since I did 360/370 assembler.

>>  prabhakar said on 12/08/06 07:12:44

prabhakar i want the total instruction set of system/370 assembly programming and programming guidelines.
i am not able to find any material for that.
plese let me know where i would be able to find them.
else pl send them to me if u have.

>>  kdakin said on 08/01/08 07:33:58

kdakin Almost no comments - a typically poor documented example
This example has drawbacks just as the other Assembler program S/390 in this list.
Use of BAL R13,... to create static save area at start of program is both unusual and inconsistent with read only/protected program storage.
Shows no particular skill and uses DCB's , DD cards and JCL when 'conventional' WTO to operator console would have been sufficient for this simple case.
Definition of doubleword 'dec' is not well documented and requires a 'keep together' comment on next 2 lines or set within own block to avoid loss of context if additional lines added in between

>>  JHT said on 04/02/10 18:12:28

JHT I've seen worse (the S/390 version of this for a start). But kdakin is correct: all programs should be annotated!

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: