× 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.



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Gary speaks the Gospel.  IBM HAS changed how these programs work.  And has
done so by changing the value of offset.  The classic example is in V5
anyone who used trigger programs and ignored the offset, but instead
figured out the position on their own, got hosed when they upgraded to V5.

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin




Gary Guthrie <garyguthrie@charter.net>
Sent by: rpg400-l-admin@midrange.com
11/15/2002 11:25 AM
Please respond to rpg400-l

        To:     rpg400-l@midrange.com
        cc:
        Fax to:
        Subject:        Re: How do I use QWCRSVAL API to retrieve
QUSRLIBL?


These examples that have hardcoded positions in the data structure for
the system value information suffer from integrity problems. If the
lengths of anything aren't coded exactly correct or if anything changes
in length or IBM adds something new to the returned structure for future
enhancements, these samples will fail to return the correct information.

You can test this by simply changing the length of the receiver variable
and running these samples. For example, change the following line:

     d USRLIBLDS       ds                  inz

to

     d USRLIBLDS       ds                  2000
     d                                     inz

and see what happens.

Any time you see an offset listed in a structure that points to another
data item or another structure from which you wish to extract
information, you must use the offset to locate the information.

If you subscribe to the iSeries Network Club Tech Programming Tips
Newsletter (e-mailed weekly), yesterday's issue had a service program
for retrieving system values. The newsletter is free and you can sign up
at:

http://www.iseriesnetwork.com/resources/clubtech/subscribe.cfm

If you're not a member of the iSeries Network (need this to subscribe to
newsletter), you can join at the same URL. Like the newsletter,
associate membership to the network is free, also.

Gary Guthrie
Editor, iSeries Network Club Tech Programming Tips Newsletter


Tom wrote:
>
> In the archives, I found an example of a program to retrieve the
QSRLNBR.
> Hacking my thru that, I was able to get it to pull the QUSRLIBL and
> QSYSLIBL.  Here it is:
>
>      h dftactgrp(*no) actgrp('QILE') bnddir('QC2LE')
>
>       ********************************************************
>       * Prototype for QWCRSVAL API - Retrieve QUSRLIBL       *
>       ********************************************************
>      d QWCRSVALU       pr                  ExtPgm('QWCRSVAL')
>      d  p_Rcvr                             Like(u_Rcvr)
>      d  p_RcvrLngth                        Like(u_RcvrLngth)
>      d  p_NbrToRtv                         Like(u_NbrToRtv)
>      d  p_SysVal                           Like(u_SysVal)
>      d  p_Error                            Like(u_APIError)
>
>       ********************************************************
>       * Prototype for QWCRSVAL API - Retrieve QSYSLIBL       *
>       ********************************************************
>      d QWCRSVALS       pr                  ExtPgm('QWCRSVAL')
>      d  p_Rcvr                             Like(s_Rcvr)
>      d  p_RcvrLngth                        Like(s_RcvrLngth)
>      d  p_NbrToRtv                         Like(s_NbrToRtv)
>      d  p_SysVal                           Like(s_SysVal)
>      d  p_Error                            Like(s_APIError)
>
>      d #QUSRLIBL       pr           250a
>      d #QSYSLIBL       pr           150a
>
>      d                 ds
>      d UsrLibl                      250
>      d SysLibl                      150
>
>      d USRLIBLDS       ds                  inz
>      d  u_Rcvr                      278a
>      d  u_RcvrLngth                   9b 0 inz(%len(u_Rcvr))
>      d  u_NbrToRtv                    9b 0 inz(1)
>      d  u_SysVal                     10a   inz('QUSRLIBL')
>      d  u_APIError                    1
>
>      d SYSLIBLDS       ds                  inz
>      d  s_Rcvr                      178a
>      d  s_RcvrLngth                   9b 0 inz(%len(s_Rcvr))
>      d  s_NbrToRtv                    9b 0 inz(1)
>      d  s_SysVal                     10a   inz('QSYSLIBL')
>      d  s_APIError                    1
>
>       ********************************************************
>       * Program Mainline                                     *
>       ********************************************************
>      c/free
>        UsrLibl=#QUSRLIBL;
>        SysLibl=#QSYSLIBL;
>        *inlr=*on;
>       /end-free
>
>       ********************************************************
>       * #QUSRLIBL  - Retrieve the QUSRLIBL library list      *
>       ********************************************************
>      p #QUSRLIBL       b                   Export
>      d #QUSRLIBL       pi           250a
>
>      d DS_SysValTbl    ds                  inz
>      d  d_ValsRtn                     9b 0
>      d  d_Offset                      9b 0
>      d  d_SysVal                     10a
>      d  d_ValType                     1a
>      d  d_InfoSts                     1a
>      d  d_DtaLngth                    9b 0
>      d  d_Data                      250a
>
>      c/free
>        reset u_APIError;
>        qwcrsvalu(u_Rcvr: u_RcvrLngth: u_NbrToRtv: u_SysVal: u_APIError);
>        ds_SysValTbl = u_Rcvr;
>        return %subst(d_Data:1:d_DtaLngth);
>       /end-free
>      p #QUSRLIBL       e
>
>       ********************************************************
>       * #QSYSLIBL  - Retrieve the QSYSLIBL library list      *
>       ********************************************************
>      p #QSYSLIBL       b                   Export
>      d #QSYSLIBL       pi           150a
>
>      d DS_SysValTbl    ds                  inz
>      d  d_ValsRtn                     9b 0
>      d  d_Offset                      9b 0
>      d  d_SysVal                     10a
>      d  d_ValType                     1a
>      d  d_InfoSts                     1a
>      d  d_DtaLngth                    9b 0
>      d  d_Data                      150a
>
>      c/free
>        reset s_APIError;
>        qwcrsvals(s_Rcvr: s_RcvrLngth: s_NbrToRtv: s_SysVal: s_APIError);
>        ds_SysValTbl = s_Rcvr;
>        return %subst(d_Data:1:d_DtaLngth);
>       /end-free
>      p #QSYSLIBL       e

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/rpg400-l
or email: RPG400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.




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.