Two problems
- Many more than one one instruction
- Does not convert a two byte packed decimal number to decimal digits
This still has more than one instruction, but in other respects is simpler than Mr. Jenson's idea and does essentially the same thing.
OPEN (PRINT,OUTPUT)
ED OUTVAL,DATA
PUT PRINT,MSG
...
PRINT DCB DSORG=PS,MACRF=PM,DDNAME=SYSPRINT,RECFM=FBA,LRECL=121
DATA DC P'12'
MSG DC 0CL121' THE VALUE IN DATA IS NNN'
DC C' THE VALUE IN DATA IS'
OUTVAL DC 0C' NNN',C' ',X'202120',CL(L'MSG-(*-MSG))' '
Sorry about the complicated way the output message is defined.
Sadly, perhaps, but I've become addicted to complex DC statements like
0C' NNN',C' ',X'202120',CL(L'MSG-(*-MSG))' '
0C' NNN',C' ',X'202120'
Specifies the edit instruction pattern. 0C' NNN' is a relatively high level abstraction of the effect of the pattern, and
C' ',X'202120' is the actual pattern. Personally, I find this better than X'40202120' since I don't have to memorize 40 as an EBCDIC blank, even though most Assembler programmers have this memorized - even me. However -
OUTVAL DC 0C' NNN,NNN,NNN',C' ',3X'20',C',',3X'20',X'202120'
After more than 40 years one would think I have comma memorized. But I don't!
CL(L'MSG-(*-MSG))' ' Fills out the line with blanks. L'MSG is the Assembler determine length of the data area specified by the symbol MSG, so
(L'MSG-(*-MSG)) becomes the bytes to fill out the line *-MSG directs the Assembler to calculate the number of bytes from the address assigned to MSG and the location counter.