× 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: ERRNO
  • From: Tim McCarthy <timm@xxxxxxxxxxxx>
  • Date: Tue, 13 Jun 2000 15:34:19 -0400

I thought I had a full bag of tricks but this is one I'm missing and
will definitely use... thanks Phil.
> -----Original Message-----
> From: Phil Hall [SMTP:hallp@ssax.com]
> Sent: Tuesday, June 13, 2000 2:05 PM
> To:   c400-l@midrange.com
> Subject:      ERRNO
> 
> Tired of looking up the ERRNO values in the header files or looking in
> QCPFMSG by typing dspmsgd xxxYYYY ?
> 
> Compile this source and call it as;
> 
>         call qerrno '3025'
> 
> To display the message text. This can be useful from with in a
> program,
> using the OS message text saves you having to type it and more
> importantly
> having to translate it for other countries.
> 
> --phil
> 
> /*==================================================================*/
> /*= QERRNO                                                         =*/
> /*=                                                                =*/
> /*= Given ERRNO value, reports reason                              =*/
> /*=                                                                =*/
> /*= Phil Hall                                                      =*/
> /*==================================================================*/
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> #include <errno.h>
> 
> #include <qmhsndpm.h>
> 
> /*++++ defines    +++++*/
> #define _SendUserRuntimeMsg(x) sndpgmmsg("CPF9897", x, "*STATUS   ",
> "*EXT
> ", 0)
> #define _SendUserCompMsg(x) sndpgmmsg("CPF9897", x, "*COMP     ", "*
> ", 3)
> 
> /*++++ prototypes +++++*/
> void sndpgmmsg(char *msg_id, char *msg_data, char *msg_type, char
> *to_msgq,
> int stack_lvl);
> 
> /*++++ structures +++++*/
> typedef struct error_code_struct
> {
>     int  bytes_provided;
>     int  bytes_avail;
>     char expt_id[7];
>     char RESERVED;
>     char expt_data[100];
> } Error_Code_Struct;
> 
> /*++++ globals    +++++*/
> char userMsgBuffer[75];
> 
> int main(int argc, char **argv)
> {
>   int  errno_val = 0;
>   char *errno_txt;
>   char msg_buffer[78];
> 
>     if (argc != 2)
>     {
>         _SendUserCompMsg("You did not supply an ERRNO value");
>         return -1;
>     }
> 
>     /*-- get supplied errno --*/
>     errno_val = atoi( argv[1] );
>     errno_txt = strerror( errno_val );
> 
>     if ( strstr( errno_txt, "QCPFMSG" ) )
>     {
>         sprintf( msg_buffer, "ERRNO(%d) Does not exist", errno_val);
>         _SendUserCompMsg( msg_buffer );
>     }
>     else
>     {
>         sprintf( msg_buffer, "ERRNO(%d) = %s", errno_val, errno_txt);
>         _SendUserCompMsg( msg_buffer );
>     }
> 
> 
>     return 0;
> }
> 
> void sndpgmmsg(char *msg_id, char *msg_data, char *msg_type, char
> *to_msgq,
> int stack_lvl)
> {
>   Error_Code_Struct  err_code;
>   char               msg_key[4];
>   char               tmp_msg_id[7];
>   char               tmp_msg_type[10];
>   char               tmp_to_msgq[10];
> 
>     memset(&err_code, 0, sizeof(err_code));
> 
>     /* copy parms to AS/400 API format... */
>     memcpy(tmp_msg_id, msg_id, sizeof(tmp_msg_id));
>     memcpy(tmp_msg_type, msg_type, sizeof(tmp_msg_type));
>     memcpy(tmp_to_msgq, to_msgq, sizeof(tmp_to_msgq));
> 
>     /* send message... */
>     QMHSNDPM(tmp_msg_id,
>              "QCPFMSG   QSYS      ",
>              msg_data,
>              strlen(msg_data),
>              tmp_msg_type,
>              tmp_to_msgq,
>              stack_lvl,
>              msg_key,
>              &err_code);
> }
> 
> 
> +---
> | This is the C/400 Mailing List!
> | To submit a new message, send your mail to C400-L@midrange.com.
> | To subscribe to this list send email to C400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to
> C400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
> bob@cstoneindy.com
> +---
+---
| This is the C/400 Mailing List!
| To submit a new message, send your mail to C400-L@midrange.com.
| To subscribe to this list send email to C400-L-SUB@midrange.com.
| To unsubscribe from this list send email to C400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: bob@cstoneindy.com
+---


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.