Why do I need to set the Record Pointer to NULL or 0 the first time I call a VsamStoreField for a new record?
Record Pointers are pointers to allocated memory blocks that hold individual records. By setting the record pointer to 0 you signal to VsamStoreField to create a brand new record buffer with the stored field in it. You should use the record pointer returned from this call on subsequent calls to VsamStoreField to finish storing fields. Once the fields have been set, you can then call VsamPut. If you call VsamStoreField without initializing the record pointer to 0, or by reading an older record with VsamGet, it will assume that it is a pointer to a previously allocated record buffer. If It tries to use this memory, it is likely that it is un-initialized memory or invalid memory and the Windows OS will get very unhappy and start to cry!! Normally, you would read a record using VsamGet which would free an old record pointer (non-zero) and its associated memory and then allocate a new one for the new record. This is why you should always initialize a Record pointer to 0 the first time so it