So for the answers I have provided, can you tell me if my understanding is correct for each and is there a better way to do it?:
When we are reading PDS using QSAM, we can get details of every data member of the PDS. The first 2 bytes of the PDS block indicates the number of used byes of the block. Following those 2 bytes, the data member details are stored. The member name is 8 bytes long followed by 2 bytes used for relative track number and 1 byte is used as relative block number. The very next byte after this TTR contains information such as bit 0 indicates if member name is an alias or not, bits 1-2 indicate the number of pointers to locations with the member and bits 3-7 is the length of the user data field as the number of halfwords.
To locate next data member from PDS, do the following:
1. Read byte containing user data length
2. Remove additional bits
3. Convert halfword length into number of bytes
4. Starting from member name, add length of user data and length of other details to get exact address of the next data member name.
NOSHBLK LA 3,BUFFER
REPEAT MVC 0(50,4),0(3)
I don't know if I should ask this here or create another topic, but I have another question regarding a concept (linked list using dynamically-allocated links). What can I do to make it better or is what I have correct?:
Each link is 40 bytes in size, the contents of link are in this order:
--- a fullword which is a LEFT pointer
--- a fullword which is a RIGHT pointer
--- 32 bytes of data
So I can use (don't have to) EQUATE: LINKSIZE EQU 40, XSAVE, RETURN macros in my subroutines.
Base register should be 12 and I must define a save area.
Part 1: Write subroutine called NEWLINK which will dynamically allocate 1 link and return its address in a fullword parameter. (new link should be initialized: the pointers should have the value 0 and the data should be blanks)
Part 2: Write subroutine called DELINK which will deallocate a link whose address is provided in a fullword parameter.
Here is what I have so far:
NEWLINK DS 0H
MVC 8(32,2),=32C' '
NSAVE DS 2F
DELLINK DS 0H
DSAVE DS F