This is the simple code I wrote to teach myself little Assembler .
All the code is doing is copying the data in variable TCH to PS Dataset .
When I am running this program job abends with S0C1 abend .
If any one can help me to point me what mistake I am doing ?
I tried to do little dump analysis of SYSUDUMP I am getting lost when PUT macro executes ( ICM instruction executes within macro ) .
Code:
TITLE 'TEST DATASET PROGRAM'
TESTDS CSECT
SAVE (14,12) SAVING THE STATE OF REGISTERS
BASR 12,0 ESTABLISH BASE ADDRESS
USING *,12 ESTABLISH BASE ADDRESS
ST 13,SAV1+4
LA 13,SAV1
*PRACTISING ASSEMBLER MACROS ON DATASET
OPEN (OUTX,(OUTPUT))
PUT OUTX,TCH
CLOSE OUTX
OUTX DCB DDNAME=MYOUT,DSORG=PS,MACRF=(PM),RECFM=FB,LRECL=80, X
BLKSIZE=80
*RETURN CONTROL TO OS
L 13,SAV1+4
RETURN (14,12),RC=0
BR 14
*VARIABLES AND SAVEAREAS
Is it like all the constants and variables used in any assembler program should be group together and coded ?
When you say DCB is not executable ( I can also see that in DUMPS it contains all data constants ) can I find same information in manual where it says where you should code your DCB .
Sorry if I sound silly , its just I am new to Assembler and learning from all the source available on net .
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
SHARE has run an Assembler Boot Camp several times during their annual conference. Google assembler boot camp for more information. There are several sessions during the week and they will give you at least a basic understanding of z/OS assembler.
The DCB is a rather large data area. Part of it is supplied by your program in the DCB macro, the remainder is filled in when you open the DCB.
LA 1,ADCB
LA 0,ANAREA
Those instruction are pretty self explanatory.
SLR 15,15
ICM 15,7,49(1)
BALR 14,15
To fully understand these instructions we must go back to history.
OS/360 was supposed to run in a system with 32K bytes of storage. Now this is hard to comprehend in a day when the desktop workstation I'm using to compose this has 6 gigabytes of storage, but in 1965/1966 32K was a BIG machine. The programmers were fighting for every byte of storage. The OS/360 PUT macro was
L 15,48(,1)
BALR 14,15
The storage byte at offset 48 in the DCB was used for something - I no longer remember what it was used for and it's not important. The 24-bit address of the code that processes a PUT request was (and still is) filled in by OPEN in bytes 49 through 51. In System/36 only the low order 24-bits of register 15 were used for the branch address in the BALR; the high order 8 bits were ignored. In the early 1980s when IBM provided for more than 16 meg of storage the old code would no longer work, so IBM changed it to SLR/ICM/BALR to make sure the higher order byte of register 15 was 0 before it executed the BALR instruction.