Language Assembler (System/370)
| Date: | 04/20/05 |
| Author: | R. Heemskerk |
| URL: | n/a |
| Comments: | 4 |
| Info: | n/a |
| Score: |
* 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
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
please mail me. my mail id:rmsh_raju@yahoo.com
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.
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