QsyFindValidationLstEntry()--Find Validation List Entry API


  Syntax
 #include <qsyvldl.h>

 int QsyFindValidationLstEntry
       (Qsy_Qual_Name_T        *Validation_Lst,
        Qsy_Entry_ID_Info_T    *Entry_ID,
        Qsy_Rtn_Vld_Lst_Ent_T  *Rtn_Entry);

  Service Program Name: QSYVLDL

  Default Public Authority: *USE

  Threadsafe: Yes

The QsyFindValidationLstEntry() function finds an entry in a validation list object. The function then returns the information for the entry in the buffer that is pointed to by the Rtn_Entry parameter. To find an entry, there must be an exact match in the entry for the value that is specified in the Entry_ID parameter and the length of the entry ID. For example, an entry ID value of "SMITH" with a length of 5 would not find an entry where the entry ID is "SMITH " and the length is 7.

Authorities

Validation List Object
*USE

Validation List Object Library
*EXECUTE

Note: If the QsyEncryptData attribute is set to QSY_VFY_FIND_E (1), then the user must have *USE, *ADD, and *UPD authority to the validation list to get the data to be encrypted returned in the Rtn_Entry parameter.


Parameters

Validation_Lst
(Input)

A pointer to the qualified object name of the validation list in which to find the entry. The first 10 characters specify the validation list name, and the second 10 characters specify the library. You can use these special values for the library name:

*CURLIB The current library is used to locate the validation list. If there is no current library, QGPL (general purpose library) is used.
*LIBL The library list is used to locate the validation list.

Entry_ID
(Input)

A pointer to the entry ID information. The format of the Qsy_Entry_ID_Info_T structure is as follows:

int Entry_ID_Len The number of bytes of data that is provided as the entry ID. Possible values are from 1 through 100.
unsigned int Entry_ID_CCSID An integer that represents the CCSID for the entry ID. Valid CCSID values are in the range 0 through 65535. This value is not used to find the entry.
unsigned char Entry_ID[100] The data that is used to identify this entry in the validation list.


Rtn_Entry
(Output)

A pointer to the buffer where the entry information is placed. The buffer must be allocated to the size of the Qsy_Rtn_Vld_Lst_Ent_T structure or the results will be unpredictable. The format of the Qsy_Rtn_Vld_Lst_Ent_T structure is as follows:

Qsy_Entry_ID_Info_T Entry_ID_Info The entry ID information structure.
Qsy_Entry_Encr_Data_Info_T Encr_Data_Info The data to be encrypted information structure.
Qsy_Entry_Data_Info_T Entry_Data_Info The entry data information structure.
char Reserved[4] This is an ignored field.
void * Entry_More_Info A pointer to additional information. This pointer is currently set to NULL.

See the Entry_ID parameter for the format of the Qsy_Entry_ID_Info_T structure.

The format of the Qsy_Entry_Encr_Data_Info_T structure is as follows:

int Encr_Data_Len The number of bytes of encrypted data that is stored in this validation list entry. If the QsyEncryptData attribute is 0 or the QRETSVRSEC system value is '0', the length will always be 0.
unsigned int Encr_Data_CCSID The CCSID associated with the encrypted data.
unsigned char Encr_Data[600] If the QsyEncryptData attribute is 1 and the QRETSVRSEC system value is '1', then the encrypted data that is stored in the entry will be decrypted and returned in this field. If the QsyEncryptData attribute is 0 or the QRETSVRSEC system value is '0', then the encrypted data cannot be returned, and the contents of this field are unpredictable.

The format of the Qsy_Entry_Data_Info_T structure is as follows:

int Entry_Data_Len The length of the entry data.
unsigned int Entry_Data_CCSID The CCSID associated with the entry data.
unsigned char Entry_Data[1000] The entry data.


Return Value

0 QsyFindValidationLstEntry() was successful. The return value points to the entry.
-1 QsyFindValidationLstEntry() was not successful. The errno global variable is set to indicate the error.


Error Conditions

If QsyFindValidationLstEntry() is not successful, errno indicates one of the following errors:

3401 [EACCES]

The current user does not have *USE authority to the validation list object, or does not have *EXECUTE authority to the validation list object library.

3406 [EAGAIN]

The validation list object is currently locked by another process.

3484 [EDAMAGE]

The validation list object is damaged.

3021 [EINVAL]

Parameter value is not valid.

3025 [ENOENT]

The validation list object was not found.

3026 [ENOREC]

Specified entry does not exist.

3474 [EUNKNOWN]

Unknown system state. Check the job log for a CPF9872 message.


Example

The following example finds all the entries in the validation list object WEBUSRS where the entry ID starts with 'abc'.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <qsyvldl.h>
#include <errno.h>

main()
{
  #define VLD_LST  "WEBUSRS   WEBLIB    "
  Qsy_Rtn_Vld_Lst_Ent_T  entry_1;
  Qsy_Rtn_Vld_Lst_Ent_T  entry_2;
  Qsy_Rtn_Vld_Lst_Ent_T  *input_info,
                         *output_info,
                         *temp;
  Qsy_Entry_ID_Info_T    *input_entry;
  short int              i;
  int                    rtn_errno;

  /* Set up entry ID to find.                                       */
  strncpy(entry_1.Entry_ID_Info.Entry_ID,"abc",3);
  entry_1.Entry_ID_Info.Entry_ID_Len = 3;

  /* Initialize pointers to input and output buffers.               */
  input_info = addr(entry_1);
  output_info = addr(entry_2);

  /* Try to find an entry for 'abc'.                                */
  rtn_errno = QsyFindValidationLstEntry(
                        (Qsy_Qual_Name_T *)&VLD_LST,
                        &entry_1.Entry_ID_Info,
                        output_info))
  /* If an 'abc' entry does not exist.                              */
  if (0 != rtn_errno && ENOREC == errno)
    /* Find the next entry after 'abc'.                             */
    rtn_errno = QsyFindNextValidationLstEntry(
                              (Qsy_Qual_Name_T *)&VLD_LST,
                              &entry_1.Entry_ID_Info,
                              output_info))

  while (0 == rtn_errno &&
         3 <= output_info->Entry_ID_Info.Entry_ID_Len &&
         0 == strncmp(output_info->Entry_ID_Info.Entry_ID,"abc",3))
  { /* Process all the entries in the validation list that          */
    /* begin with 'abc'.                                            */
          .
          .
          .
     (process the entry)
          .
          .
          .
    /* Switch the pointers to the buffers so that the output from   */
    /* the last find operation is used as input to the 'find-next'  */
    /* operation.                                                   */
    temp = output_info;
    output_info = input_info;
    input_info = temp;

    /* Find the next entry.                                         */
    rtn_errno = QsyFindNextValidationLstEntry(
                              (Qsy_Qual_Name_T *)&VLD_LST,
                              &(input_info->Entry_ID_Info),
                              output_info))
  }
  /* Check if an error occurred.                                    */
  if (0 != rtn_errno && ENOREC != errno)
    perror("Find of validation list entry");

}



API introduced: V4R1

[ Back to top | Security APIs | APIs by category ]