The following example creates a non-shared standard hiperspace
named SCROLLHS. The size of the hiperspace is 20 blocks. The program:
- Creates a non-shared standard hiperspace 20 blocks in size
- Obtains four pages of address space storage aligned on a 4K-byte
address
- Sets up the SWRITE range list parameter area to identify the first
two pages of the address space storage
- Initializes the first two pages of address space storage that
will be written to the hiperspace
- Issues the HSPSERV SWRITE macro to write the first two pages to
locations 4096 through 12287 in the hiperspace.
Later on, the program:
- Sets up the SREAD range list parameter area to identify the last
two pages of the four-page address space storage
- Issues the HSPSERV SREAD macro to read the blocks at locations
4096 through 12287 in the hiperspace to the last two pages in the
address space storage.
Figure 1 shows the four-page area in the address space
and the two block area in
the hiperspace. Note that the first two pages of the address space
virtual storage are unpredictable after the SWRITE operation.
Figure 1. Example of creating a standard hiperspace and transferring data
* DSPSERV CREATES A STANDARD TYPE HIPERSPACE OF 20 4096-BYTE BLOCKS
*
DSPSERV CREATE,NAME=HSNAME,TYPE=HIPERSPACE,HSTYPE=SCROLL, X
BLOCKS=20,STOKEN=HSSTOKEN
*
* THE STORAGE MACRO OBTAINS FOUR PAGES OF ADDRESS SPACE STORAGE.
* THE BNDRY=PAGE PARAMETER ALIGNS PAGES ON A 4K BOUNDARY
* - THE FIRST AND SECOND PAGES ARE THE SWRITE SOURCE
* - THE THIRD AND FOURTH PAGES ARE THE SREAD TARGET
*
STORAGE OBTAIN,LENGTH=4096*4,BNDRY=PAGE
ST 1,ASPTR1 * SAVES THE SWRITE SOURCE ADDRESS
MVC 0(20,1),SRCTEXT1 * INITIALIZES SOURCE PAGE ONE
A 1,ONEBLOCK * COMPUTES SOURCE PAGE TWO ADDRESS
MVC 0(20,1),SRCTEXT2 * INITIALIZES SOURCE PAGE TWO
*
* HSPSERV WRITES TWO PAGES FROM THE ADDRESS SPACE TO THE HIPERSPACE
*
HSPSERV SWRITE,STOKEN=HSSTOKEN,RANGLIST=RANGPTR1,NUMRANGE=ONE
*
* THE SYSTEM REUSES THE FIRST TWO ADDRESS SPACE PAGES AFTER THE SWRITE
.
* SET UP THE SREAD RANGE LIST TO READ INTO THE THIRD AND FOURTH
* ADDRESS SPACE PAGES
*
L 2,ASPTR1 * OBTAINS THE ADDRESS OF PAGE 1
A 2,ONEBLOCK * COMPUTES THE SREAD TARGET ADDRESS
A 2,ONEBLOCK * COMPUTES THE SREAD TARGET ADDRESS
ST 2,ASPTR2 * SAVES IN SREAD RANGE LIST
*
* HSPSERV READS TWO BLOCKS OF DATA FROM THE HIPERSPACE TO THE
THIRD AND FOURTH PAGES IN THE ADDRESS SPACE STORAGE
*
HSPSERV SREAD,STOKEN=HSSTOKEN,RANGLIST=RANGPTR2,NUMRANGE=ONE
*
* DATA AREAS AND CONSTANTS
*
HSNAME DC CL8'SCROLLHS' * NAME FOR THE HIPERSPACE
HSSTOKEN DS CL8 * STOKEN FOR THE HIPERSPACE
ONEBLOCK DC F'4096' * LENGTH OF ONE BLOCK OF STORAGE
SRCTEXT1 DC CL20' INVENTORY ITEMS '
SRCTEXT2 DC CL20' INVENTORY SURPLUSES'
ONE DC F'1' * NUMBER OF RANGES
DS 0F
RANGPTR1 DC A(SWRITLST) * ADDRESS OF THE SWRITE RANGE LIST
RANGPTR2 DC A(SREADLST) * ADDRESS OF THE SREAD RANGE LIST
DS 0F
SWRITLST DS 0CL12 * SWRITE RANGE LIST
ASPTR1 DS F * START OF ADDRESS SPACE SOURCE
HSPTR1 DC F'4096' * TARGET LOCATION IN HIPERSPACE
NUMBLKS1 DC F'2' * NUMBER OF 4K BLOCKS IN SWRITE
DS 0F
SREADLST DS 0CL12 * SREAD RANGE LIST
ASPTR2 DS F * TARGET LOCATION IN ADDRESS SPACE
HSPTR2 DC F'4096' * START OF HIPERSPACE SOURCE
NUMBLKS2 DC F'2' * NUMBER OF 4K PAGES IN SREAD