× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: List Files
  • From: Phil Hall <hallp@xxxxxxxx>
  • Date: Mon, 30 Mar 1998 09:34:23 -0600
  • Organization: SSA

John,

> I found the QUSLOBJ API but a) not having used the user space API's
> before & b) Working in ILE-C for the first time is tough
> 
> any help will be greatly appreciated

Here's a snippet of one of my ILE/C programs functions, that builds a list of
all the files, in the supplied library name, using the QUSLOBJ API. It's
snipped, so you may need to declare some variables that got lost when I cut the
function from the rest of the program but you should be able to see how it
works from the code to be able to pulg it into your stuff...

Hope it helps...

--phil


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <qusgen.h>
#include <quscrtus.h>
#include <qusrtvus.h>
#include <quslobj.h>

typedef struct error_code_struct
{
     int bytes_provided;
     int bytes_avail;
     char expt_id[7];
     char RESERVED;
     char expt_data[100];
} error_code_struct;


...[snipped]...



void build_records(char *the_lib_name)
{
  char the_file_lib[20]      = "*ALL                ";
  Qus_Generic_Header_0100_t  spc_header;
  error_code_struct          LOBJ_err = {sizeof(ErrorCode)} ;

    sndpgmmsg_to_screen("CPF9897", "Collecting file information...", "*STATUS  
");

    /* Create a user space for all the file names */
    QUSCRTUS("FILENAMES QTEMP     ",
             "SPC        ",
             1024,
             "\0",
             "*ALL       ",
             "Temporary file list user space                ",
             "*YES       ",
             &ErrorCode,
             "*DEFAULT   ");

    /* Generate the list of files... */
    memcpy(&(the_file_lib[10]), the_lib_name, 10);

    QUSLOBJ("FILENAMES QTEMP     ",
            "OBJL0200",
            the_file_lib,
            "*FILE     ",
            &LOBJ_err);

    /* get the header... */
     QUSRTVUS("FILENAMES QTEMP     ",
              1,
              sizeof(spc_header),
              &spc_header);

    if(spc_header.Number_List_Entries == 0 )
    {
        sndpgmmsg_to_screen("CPF9897", "No files in library", "*STATUS   ");
        exit(99);
    }
    else
    {
        /* build up subfile records in memory... */
        Qus_Lobj_Input_t           list_data;
        Qus_OBJL0200_t             file_data;
        int  i;
        int  data_offset;
        int  list_data_offset;
        char *the_data_ptr;

        list_data_offset = spc_header.Offset_Header_Section + 1;
        QUSRTVUS("FILENAMES QTEMP     ",
                  list_data_offset,
                  sizeof(list_data),
                  &list_data);

        data_offset = spc_header.Offset_List_Data + 1;
        for(i=1; i <= spc_header.Number_List_Entries; i++)
        {
            QUSRTVUS("FILENAMES QTEMP     ",
                     data_offset,
                     sizeof(file_data),
                     &file_data);

            /*----  do something with the file_data ----*/


            data_offset=data_offset+sizeof(file_data);
        }
        num_of_files = i - 1;
    }
}


void sndpgmmsg_to_screen(char *msg_id, char *msg_data, char *msg_type)
{
  error_code_struct  err_code;
  char               msg_key[4];
  char               tmp_msg_id[7];
  char               tmp_msg_type[10];

    memset(&err_code, 0, sizeof(err_code));
    memcpy(tmp_msg_id, msg_id, sizeof(tmp_msg_id));
    memcpy(tmp_msg_type, msg_type, sizeof(tmp_msg_type));

    QMHSNDPM(tmp_msg_id,
             "QCPFMSG   QSYS      ",
             msg_data,
             strlen(msg_data),
             tmp_msg_type,
             "*EXT      ",
             0,
             msg_key,
             &err_code);
}



-- 
Phil Hall
________________________________________________

email . . . . : hallp@ssax.com   
phone(w). . . : (312) 258-6319

News/400 C/C++ Forum moderator at;
       http://www.news400.com/c/index.htm
________________________________________________
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.