An example of a hiperspace as a data-in-virtual object

The program in this information creates a hiperspace for temporary storage of a table of 4K bytes that the program generates and uses. The program cannot save this table permanently.

The following code creates a standard hiperspace and identifies it as a data-in-virtual object.
* CREATE A HIPERSPACE
  .
  DSPSERV CREATE,TYPE=HIPERSPACE,HSTYPE=SCROLL,                       X
     NAME=HS2NAME,STOKEN=HS2STOK,BLOCKS=ONEBLOCK
  .
* IDENTIFY THE HIPERSPACE AS A DATA-IN-VIRTUAL OBJECT
  .
  DIV     IDENTIFY,ID=OBJID,TYPE=HS,STOKEN=HS2STOK
  DIV     ACCESS,ID=OBJID,MODE=UPDATE
  DIV     MAP,ID=OBJID,AREA=OBJAREA
  .
HS2NAME  DC   CL8'MHSNAME '        HIPERSPACE NAME
HS2STOK  DS   CL8                  HIPERSPACE STOKEN
ONEBLOCK DC   F'1'                 HIPERSPACE SIZE OF 1 BLOCK
OBJID    DS   CL8                  DIV OBJECT ID
OBJAREA  DS   CL8                  WINDOW IN ADDRESS SPACE

When the hiperspace is a data-in-virtual object, your program does not need to know the origin of the hiperspace. All addresses refer to offsets within the hiperspace. Note that the example does not include the ORIGIN parameter on DSPSERV.

After you finish making changes to the data in the address space window, you can save the changes back to the hiperspace as follows:
* SAVE CHANGES TO THE OBJECT
  .
  DIV     SAVE,ID=OBJID
The following macro refreshes the address space window. This means that if you make changes in the window and want a fresh copy of the object (that is, the copy that was saved last with the DIV SAVE macro), you would issue the following:
  DIV     RESET,ID=OBJID
When you finish using the hiperspace, use the DSPSERV macro to delete the hiperspace.
* DELETE THE HIPERSPACE
  .
  DSPSERV DELETE,STOKEN=HS2STOK