Page 1 of 1

DCB programs must be reside below the line

PostPosted: Mon Nov 26, 2012 1:41 pm
by bobguo
You can assemble the DCB macro into a program that resides above the 16 MB line, but the program must move it below the line before using it. Except for the DCBE, all areas that the DCB refers to, such as EXLST and EODAD, must be below the 16 MB line.


this sentence was found from ibm red book, can anybody explain 'but the program must move it below the line before using it'? thanks.

Re: DCB programs must be reside below the line

PostPosted: Mon Nov 26, 2012 2:18 pm
by BillyBoyo
A DCB will only succeed if it exists "below the (16MB) line". If you program is above, you need to acquire storage from below the line and put the DCB there, before you use it.

Re: DCB programs must be reside below the line

PostPosted: Mon Nov 26, 2012 3:33 pm
by bobguo
can you explain why?

Re: DCB programs must be reside below the line

PostPosted: Mon Nov 26, 2012 4:46 pm
by enrico-sorichetti
because it was designed that way :mrgreen:

You might find useful to read and meditate on
Introduction to the New Mainframe: z/OS Basics
here
http://www.redbooks.ibm.com/abstracts/sg246366.html

and the series
ABCs of z/OS System Programming
( link to the first of it )
http://www.redbooks.ibm.com/abstracts/sg246981.html

Re: DCB programs must be reside below the line

PostPosted: Mon Nov 26, 2012 5:38 pm
by steve-myers
  • The DCB contains 24-bit address constants to such things as the end of data routine and the DEB. These addresses must point to data located below the line.
  • The most common form of the RDJFCB, OPEN and CLOSE macros contain 24-bit address constants to point to the DCB macros. Yes, you can specify MODE=31 on these macros to use 31-bit address constants, but the actual addresses must point to data below the 16-meg line.
  • All the data areas constructed by the OPEN macro, such as the DEB and I/O buffers are allocated below the line.
  • All the I/O routines that OPEN assigns are physically loaded below the 16-meg line. This is why you see constructs like this in the I/O macros.
    +         SR    15,15
    +         ICM   15,7,49(1)
    +         BALR  14,15
    The same macro in OS/360, OS VS2 Release 1 and early releases of MVS including the semi open source versions of MVS you can legally obtain to operate under the Hercules program to emulate System/370 build
    +         L     15,48(1,0)
    +         BALR  14,15
    The first version will correctly operate AMODE 31 as well as AMODE 24. The second version will only work AMODE 24.
  • In any event, all the common I/O macros (GET, PUT, READ, WRITE, CHECK and so on) can execute AMODE 31.

Re: DCB programs must be reside below the line

PostPosted: Mon Nov 26, 2012 6:53 pm
by bobguo
thank you for your answers.

to steve-myers:
+         SR    15,15
+         ICM   15,7,49(1)

the result of these two lines is R15's first byte is low-value, so amode=24/31, R15 must point to data located below the line.

+         L     15,48(1,0)

the result of it is R15's first bit is low-value, so it has to be used under amode=24, otherwise, it maybe point to someplace above the line, which is wrong.

right?

Re: DCB programs must be reside below the line

PostPosted: Mon Nov 26, 2012 8:37 pm
by steve-myers
bobguo wrote:...
+         SR    15,15
+         ICM   15,7,49(1)

the result of these two lines is R15's first byte is low-value, so amode=24/31, R15 must point to data located below the line.
That is correct.
bobguo wrote:...
+         L     15,48(1,0)

the result of it is R15's first bit is low-value, so it has to be used under amode=24, otherwise, it maybe point to someplace above the line, which is wrong.

right?
You are correct about AMODE. The contents of bits 0 to 7 - not just bit 0 - are unpredictable.

Re: DCB programs must be reside below the line

PostPosted: Tue Nov 27, 2012 2:48 am
by steve-myers
The title of this topic is incorrect. Programs that use DCBs can be located above the line; the actual DCBs must be located below the line. Here is a complete copy program that is located above the line.
COPY31   CSECT
COPY31   AMODE 31
COPY31   RMODE ANY
         USING *,12
         USING WA,11
         SAVE  (14,12),,*
         LR    12,15
         LA    15,SAVEAREA
         ST    15,8(,13)
         ST    13,4(,15)
         LR    13,15
         LA    0,WASIZE
         GETMAIN RU,LV=(0),LOC=(24,ANY)
         LR    11,1
         MVC   OPARM,MASTOPEN
         MVC   INPUT,MASTIN
         MVC   OUTPUT,MASTOUT
         LA    0,XLIST
         STCM  0,B'0111',(DCBEXLST-IHADCB)+OUTPUT+1
         LA    0,WAEXIT
         ST    0,XLIST
         MVI   XLIST,X'80'+5
         MVC   WAEXIT,MASTEXIT
         OPEN  (INPUT,INPUT),MF=(E,OPARM)
         OPEN  (OUTPUT,OUTPUT),MF=(E,OPARM)
         LA    0,EOFCODE
         STCM  0,B'0111',(DCBEODAD-IHADCB)+INPUT+1
         MVC   EOFCODE,EOFBR
COPYLOOP GET   INPUT
         LR    2,1
         PUT   OUTPUT,(2)
         B     COPYLOOP
EOFBR    B     EOF
EOF      MVC   OPARM,MASTCLOS
         CLOSE INPUT,MF=(E,OPARM)
         CLOSE OUTPUT,MF=(E,OPARM)
         LA    0,WASIZE
         FREEMAIN RU,LV=(0),A=(11)
         L     13,4(,13)
         RETURN (14,12),T,RC=0
         DC    0F'0'
MASTEXIT SAM31 ,
         L     15,MASTADDR-MASTEXIT(,15)
         BR    15
MASTADDR DC    A(OPENEXIT)
SAVEAREA DS    18F'0'
MASTOPEN OPEN  (*-*),MF=L
MASTCLOS CLOSE *-*,MF=L
MASTIN   DCB   DSORG=PS,MACRF=GL,DDNAME=INPUT,EODAD=*-*
MASTOUT  DCB   DSORG=PS,MACRF=PM,DDNAME=OUTPUT,EXLST=*-*
         DC    0D'0'
         LTORG ,
         DROP  ,
         DC    0F'0'
         USING *,15
I        USING IHADCB,2
O        USING IHADCB,3
OPENEXIT LHI   2,-(OUTPUT-INPUT)
         AR    2,1
         LR    3,1
         MVC   O.DCBRECFM,I.DCBRECFM
         XC    O.DCBBLKSI,O.DCBBLKSI
         MVC   O.DCBLRECL,I.DCBLRECL
         BR    14
         DROP  ,
         DC    0D'0'
WA       DSECT
INPUTS   DCB   DSORG=PS,MACRF=GL,EODAD=*-*
INPUT    EQU   INPUTS,*-INPUTS
OUTPUTS  DCB   DSORG=PS,MACRF=PM,EXLST=*-*
OUTPUT   EQU   OUTPUTS,*-OUTPUTS
OPARMS   OPEN  (*-*),MF=L
OPARM    EQU   OPARMS,*-OPARMS
XLIST    DS    A
WAEXITS  SAM31 ,
         L     15,XADDR-WAEXITS(,15)
         BR    15
XADDR    DS    A
WAEXIT   EQU   WAEXITS,*-WAEXITS
EOFCODE  DS    XL4
         DS    0D
WASIZE   EQU   *-WA
         DCBD  DSORG=QS,DEVD=DA
         END   COPY31
It is based on the apparent problem raised by the Sending Data, Fixing Problems topic.

There was a surprise found when developing the program. The DCB open exit for the OUTPUT DCB was entered with AMODE 24; I expected it to be entered AMODE 31, since the program is AMODE 31, so the entry stub in the below the line work area had to switch to AMODE 31 with the SAM31 (Set Addressing Mode 31) instruction before branching to the main exit code located above the line. The exit itself is a simplified version of the DCB setup proposed in the Sending Data, Fixing Problems topic since System Determined Blksize is a better solution.