UPAM is a block-oriented access method. The basic processing unit is the 2-Kbyte standard block for K-PAM files and the logical block for NK-PAM files, its size being determined by the BLKSIZE operand in the FCB and FILE macro or the BUFFER-LENGTH operand in the ADD-FILE-LINK command. UPAM can read in or output up to 16 2-Kbyte standard blocks at the same time. This number is defined with the LEN operand in the PAM macro. If LEN=(STD,n) or LEN=n*2048 is specified, then n <= 16.
The following point applies to K-PAM files:
If the value specified for the LEN operand in the PAM macro is not an integer multiple of 2048, it is rounded up to the next higher integer multiple of 2048.
In the case of a write operation, the remainder of the last PAM page to be written in the file is undefined. If this write operation took place at the end of the file and this file is then closed, the position of the last valid byte on this PAM page is stored in the catalog entry's last-byte pointer.
For a read operation, the remainder of the last PAM page to be read is not passed to the buffer.
The following point applies to NK-PAM files:
If the value specified for the LEN operand in the PAM macro is not an integer multiple of the size of a logical block, it is rounded up to the next higher integer multiple of the logical block size.
In the case of a write operation, the remainder of the logical block in the file is undefined. If this write operation took place at the end of the file and this file is then closed, the position of the last valid byte of the last logical block is stored in the catalog entry's lastbyte pointer.
For a read operation, the remainder of the last logical block to be read is not passed to the buffer and the remainder of the buffer contents is undefined.
A last-byte pointer with the value 0 means that the last logical block of the file is completely valid (for exceptions see the REPAIR-DISK-FILE command and VERIF macro).
A last-byte pointer with the value 0 means that the last logical block of the file is completely valid (for exceptions see the REPAIR-DISK-FILE command and VERIF macro).
The SHOW-FILE-ATTRIBUTES command outputs the value of the last-byte pointer in the allocation part as LAST-BYTE or S variables if the corresponding valid bit has been set in the catalog entry of the file. The last-byte pointer points to the last valid byte of the last logical block in a file.
In case of problems, the customer service may be able to reset the last-byte pointer.
Prerequisite for the usage of the last-byte pointers for PAM files on public space is the setting of the LBP_REQUIRED indicator in the file control block (FCB) for OPEN. LBP_REQUIRED makes the LBP in the FCP accessible during OPEN and saves the updated value in the catalog entry during CLOSE.
With PAM node files, a last-byte pointer is always supplied, irrespective of the LBP_REQUIRED flag. However, it is to be noted that the LBP in the CE may be outdated, as the file might have been changed by another system. Therefore, the current valid lastbyte pointer is identified and made accessible to the application in the file control block (FCB) during OPEN.
Example
The operands WRT and LEN=5000 are specified in a PAM call for a file with BLKCTRL=NO and BLKSIZE=(STD,2) (which is equivalent to BLOCK-CONTROL-INFO=*NO and BUFFER-LENGTH=*STD(SIZE=2) in the ADD-FILE-LINK command). 5000 bytes are transferred from the buffer, and the remainder up to the next highest integer multiple of the logical block size (8192 bytes) is undefined.
If the write operation in the example took place at the end of the file and the file was then closed, the last-byte pointer has the value 904. Consequently 904 bytes were written in the 4th and at the same time last logical block of the file. The last-byte pointer, like the last-page pointer (here LPP=8), is noted in the catalog entry when the file is closed and is used by the application to ascertain the precise end of file after the file has been opened again.