For a set request, the program determines whether the location to change does not extend past the maximum object size allowed. If the location is past the end of the current window, the program saves any existing changes to the object, and creates a window containing the page to be changed. It then changes the data in storage (but not in the linear data set).
* SET: See if the location to change is within the range of the current
* MAP. If not, save any changes, get a larger area and issue a new MAP.
C R1,VSIZEB Area to change within current MAP?
BL LGUPDCHR * Yes -- continue
C R1,CSIZEMX Area to change within max allowed?
BNL LINVADDR * No -- is error
CLI VSWUPDT,0 Any updates to current MAP ?
BE LNOSVE1 * Yes -- then
DIV SAVE,ID=VTOKEN Save any changes
LA R2,5 Error code from SAVE
LTR R15,R15 SAVE ok ?
BNZ LERROR * No -- quit
MVI VSWUPDT,0 Clear update flag
LNOSVE1 L R3,VSIZEB Eliminate old map and storage
LTR R3,R3 Any to free ?
BZ LNOFREE * Yes -- then
DIV UNMAP,ID=VTOKEN,AREA=VAREAPTR Release the MAP
LA R2,6 Error code from UNMAP
LTR R15,R15 UNMAP ok ?
BNZ LERROR * No -- quit
L R1,VAREAPTR R1 -> acquired storage
FREEMAIN RU,A=(1),LV=(R3) Free the storage
LNOFREE L R2,VCHGADDR Address of byte to change
SRL R2,12 R2 = page number - 1
LA R2,1(,R2) R2 = page number to use
ST R2,VSIZEP VSIZEP = MAP area in 4K units
SLL R2,12 R2 = size in bytes
ST R2,VSIZEB VSIZEB = MAP area in bytes
GETMAIN RU,LV=(R2),LOC=(ANY,ANY),BNDRY=PAGE get MAP area
ST R1,VAREAPTR Save MAP area
DIV MAP,ID=VTOKEN,AREA=VAREAPTR,SPAN=VSIZEP
LA R2,3 Error code
LTR R15,R15 MAP work ok ?
BNZ LERROR * No -- quit
LGUPDCHR L R1,VCHGADDR R1 = byte to change
A R1,VAREAPTR R1 -> byte to change
MVC 0(1,R1),VCARDV Change the byte
MVI VSWUPDT,X'FF' Show change made
B LGOODINP Go print accept message
LDISP EQU * Display location contents
L R1,VCHGADDR R1 = location to display
C R1,VSIZEB Ensure within current MAP
BNL LINVADDR * If not, is error
A R1,VAREAPTR R1 -> location to display
MVC VCARDV,0(R1) Put into the card