|
How about now?
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)
********************************************************
* Prototype for #RtvLibl procedure - calls QWCRSVAL *
********************************************************
d #QUSRLIBL pr 250a
d #QSYSLIBL pr 150a
d ds
d UsrLibl 250
d SysLibl 150
d USRLIBLDS ds 2000
d 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 2000
d 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 OffsetData ds
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;
OffsetData = %subst(u_rcvr:d_Offset+1);
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 OffsetData ds
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;
OffsetData = %subst(s_rcvr:d_Offset+1);
return %subst(d_Data:1:d_DtaLngth);
/end-free
p #QSYSLIBL e
Gary Guthrie <garyguthrie=xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote
in 3DD5200E.E1D221A1@charter.net:">news:3DD5200E.E1D221A1@charter.net:
> 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.
>
<snip>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.