/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ initialize program data elements\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

char initial_value = ðxðð;

 

 

 

 

 

char text_description[5ð] =

 

 

 

 

 

"test of QDBLDBR API

 

 

 

";

 

char qualified_usrspc_name[2ð] = "GETLDBR

QTEMP

";

 

 

Qus_EC_t error_code;

 

 

 

 

 

Qus_Generic_Header_ð1ðð_t \header_ptr;

 

 

 

 

error_code.Bytes_Provided = ð;

 

 

 

 

 

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

 

/\ Create the user space to hold API results

 

\/

 

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

 

QUSCRTUS(qualified_usrspc_name, "SPACE

", 1,

 

 

 

&initial_value, "\ALL

", text_description,

 

 

"\YES

", &error_code, "\USER

");

 

 

 

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

 

/\ Get list of file dependencies in current library

 

\/

 

/\

 

 

 

 

\/

 

/\ Note that in this API call NULL pointers are being

 

\/

 

/\ used for the "ignored" parameters Member and

 

\/

 

/\ Record_Format.

This convention is not valid as the

 

\/

 

/\ parameters must address a valid storage address.

 

\/

 

/\ The value

 

 

 

 

\/

 

/\ assigned to a storage location is not important, the

\/

 

/\ passing of a valid storage location is.

 

 

\/

 

/\

 

 

 

 

\/

 

/\ The next statement will cause a MCH36ð1

 

 

\/

 

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

 

QDBLDBR(qualified_usrspc_name, "DBRLð1ðð", "\ALL

\CURLIB

",

NULL, NULL, &error_code);

.12/

 

 

 

 

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/ /\ Get pointer to user space which contains dependencies \/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

QUSPTRUS(qualified_usrspc_name, &header_ptr, &error_code);

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ and display number of entries generated\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

printf("The number of entries returned is %d\n", header_ptr->Number_List_Entries);

}

Using Null Pointers with OPM APIs—Example of Correct Coding

The following program specifies that blanks be used as the values fo member and record format parameters. This coding.13/ison shownpage at9-21

in the example program. By using blanks, the storage or address locat parameters is identified and passed when needed.

Chapter 9. Common API Programming Errors 9-19

Page 225
Image 225
IBM Version 4 manual Using Null Pointers with OPM APIs-Example of Correct Coding, Qtemp