gtpc2mia | C/C++ Language Support User's Guide |
This function converts a binary persistent identifier (PID) to an EBCDIC string.
Format
#include <c$to2.h> long TO2_convertBinPIDtoEBCDIC (const TO2_PID_PTR binary_pid_ptr, TO2_ENV_PTR env_ptr, char EBCDIC_pid_output[64] long *pid_output_length);
Normal Return
The normal return is a positive value.
Error Return
An error return is indicated by a zero return code. When zero is returned, use the TO2_getErrorCode function to determine the specific error code. For more information, see Error Handling.
The following error code is common for this function:
TO2_ERROR_ENV
Programming Considerations
This function does not use TPF transaction services on behalf of the caller.
Examples
The following example converts a PID to an EBCDIC string.
#include <c$to2.h> /* Needed for TO2 API functions */ #include <stdio.h> /* APIs for standard I/O functions */ TO2_ENV_PTR env_ptr; /* Pointer to the TO2 environment */ TO2_PID collect; char pid_buffer[64]; long pid_length;
·
·
·
/**********************************************************************/ /* Make sure that the collection PID is assigned before arriving here.*/ /**********************************************************************/ pid_length = sizeof(pid_buffer); if (TO2_convertBinPIDtoEBCDIC(&collect, env_ptr, pid_buffer, &pid_length) == TO2_ERROR) { printf("TO2_convertBinPIDtoEBCDIC failed!\n"); process_error(env_ptr); } else { printf("TO2_convertBinPIDtoEBCDIC successful!\n"); printf("The PID may now be displayed as %s",pid_buffer); }
Related Information