900-GENERIC-API-VALIDATION
You can test for the existence of a hidden API using the 900-GENERIC-API-VALIDATION API. You must to
supply the index number of the hidden API to test for and then the 900-GENERIC-API-VALIDATION will run 900-GENERIC-API with "V" (for validate) as
the GENAPI-FUNCTION
value. FOUND or NOTFOUND is returned in the GENAPI-RESULT
field. (The hidden API
is not run by this call.)
Library
|
SYSCMDS |
Input
Field | Definition |
---|---|
GENAPI-API-INDEX
|
Number indicating which of the hidden APIs is called by the Generic API. Valid values are from 1 to 99. A special test API has already been assigned a value of 90, so any new hidden APIs do not have this value. To call the hidden API, the 4GL program must have the index value for the hidden API: 2 = calls the hidden API that gets the size of the file. 3 = calls the hidden API that copies a single file to the destination directory. 4 = calls the hidden API that creates directory along with any required parent directories. 7 = calls the hidden API that creates empty files. |
Output
Field | Definition |
---|---|
GENAPI-RESULT
|
Result of the call through 900-GENERIC-API , can be FOUND or NOTFOUND. |
Programming Example
This information shows the use of 900-GENERIC-API-VALIDATION to check for the existence of the test hidden API.
MOVE 90 TO GENAPI-API-INDEX.
PERFORM 900-GENERIC-API-VALIDATION.
IF (GENAPI-NOTFOUND)
DISPLAY "Generic API Test API was Not Found"
ELSE
IF (GENAPI-FAILED)
DISPLAY "Generic API Test API Failed - Error: ", GENAPI-ERROR-NBR
DISPLAY "Error Msg: ", GENAPI-ERROR-MSG
ELSE
IF (GENAPI-FOUND)
MOVE "This is in the first 50 bytes of the Input Buffer"
TO GENAPI-API-INPUT-PRMS
MOVE "R" TO GENAPI-FUNCTION
PERFORM 900-GENERIC-API
IF (GENAPI-FAILED)
DISPLAY "Run of Generic API Test API Failed - Error: ", GENAPI-ERROR-N
DISPLAY "Error Msg: ", GENAPI-ERROR-MSG
ELSE
DISPLAY GENAPI-API-OUPUT-PRMS.