|
Scott, thank you very much! This was very helpful. However, I now have another question. Basically, I am trying to (programmatically) get a list of all jobs running on a device, so I can end them in order to vary the device off and on. I seem to find that if a workstation is running either group jobs or alternative jobs, this API doesn't list them all. It will find them one at a time (as you end one, the next one becomes active), but there's sometimes a bit of a delay, which can be confusing (does "no job" mean no job, or just next job hasn't become f ully active?). I've been able to cobble something together using loops and delays, but I wonder if anyone has a more elegant solution? TIA, midrange-l@midrange.com writes: >On Thu, 16 Aug 2001, Mike Naughton wrote: >> >> Does anyone have an example of using the QDCRCFGS API that they'd be >> willing to share? I'd be interested in either RPG(LE) or CL. >> > >Here, I whipped up an example for you... I wasn't sure what you >wanted to use the API for, so I just displayed a bunch of stuff... > >Compile with: CRTBNDRPG PGM(xxx) SRCFILE(XXX/xxx) DBGVIEW(*LIST) > run with: CALL XXX PARM('*DEVD' 'DSP01') (or whatever you like) > >you can take it from there... > > H DFTACTGRP(*NO) ACTGRP(*NEW) OPTION(*SRCSTMT) > > D RtvCfgSts PR ExtPgm('QDCRCFGS') > D RcvVar 32766A options(*varsize) > D RcvVarLen 10I 0 const > D Format 8A const > D CfgDType 10A const > d CfgDName 10A const > D ErrorCode 32766A options(*varsize) > > D p_ds1 S * > D ds1 DS based(p_ds1) > D ds1BytesRtn 10I 0 > D ds1BytesAvl 10I 0 > D ds1Status 10I 0 > D ds1DateRtv 7A > D ds1TimeRtv 6A > D ds1StatusTxt 20A > D ds1JobName 10A > D ds1JobUser 10A > D ds1JobNbr 6A > D ds1PassThr 10A > D ds1Reserv1 3A > D ds1OffActCnv 10I 0 > D ds1NbrActCnv 10I 0 > D ds1LenActCnv 10I 0 > D ds1OffMulJob 10I 0 > D ds1NbrMulJob 10I 0 > D ds1LenMulJob 10I 0 > > D p_ds2 S * > D ds2 DS based(p_ds2) > D ds2CnvSts 10I 0 > D ds2CnvStsTxt 20A > D ds2CnvStsMod 10A > D ds2CnvStsJob 10A > D ds2CnvStsUsr 10A > D ds2CnvStsNbr 6A > > D p_ds3 S * > D ds3 DS based(p_ds3) > D ds3MultJob 10A > D ds3MultUser 10A > D ds3MultNbr 6A > > D dsEC DS > D dsECBytesP 1 4I 0 inz(256) > D dsECBytesA 5 8I 0 inz(0) > D dsECMsgID 9 15 > D dsECReserv 16 16 > D dsECMsgDta 17 256 > > D p_workspace S * > D workspace S 1A based(p_workspace) > D size S 10I 0 > D Msg S 52A > D X S 10I 0 > D pause S 1A > > c *entry plist > c parm CfgType 10 > c parm CfgName 10 > > c eval *inlr = *on > > C* Reserve space for up to 200 active convs & 200 multjobs... > c eval size = %size(ds1) + (%size(ds2)*200) + > c (%size(ds3)*200) > c alloc size p_workspace > > C* Call Retrieve Cfg Status API: > c callp RtvCfgSts(workspace: size: 'CFGS0100': > c CfgType: CfgName: dsEC) > c if dsECBytesA > 0 > c eval Msg = 'QDCRCFGS failed with ' + > c dsECMsgID > c dsply Msg > c return > c endif > > c eval p_ds1 = p_workspace > > C** Show status of cfg descr: > c eval Msg = 'Status = ' + ds1StatusTxt > c Msg dsply > > C** Show job using cfg descr: > c if ds1JobName <> *blanks > c eval Msg = 'Job = ' + %trimr(ds1JobName) + > c '/' + %trimr(ds1JobUser) + '/' + > c ds1JobNbr > c Msg dsply > c endif > > C** Show any active conversations: > c do ds1NbrActCnv X > c eval p_ds2 = p_workspace + ds1OffActCnv + > c ((X-1) * ds1LenActCnv) > c eval Msg = 'ActCnv ' + %trim(%editc(X:'Z')) > c + ' status = ' + ds2CnvStsTxt > c Msg dsply > c eval Msg = 'ActCnv ' + %trim(%editc(X:'Z')) >+ > c ' job = ' + %trimr(ds2CnvStsJob) + > c '/' + %trimr(ds2CnvStsUsr) + '/' + > c ds2CnvStsNbr > c Msg dsply > c enddo > > C** If this device can be used by multiple jobs, > C** show them all now: > c do ds1NbrMulJob X > c eval p_ds2 = p_workspace + ds1OffMulJob + > c ((X-1) * ds1LenMulJob) > c eval Msg = 'MultJob ' + >%trim(%editc(X:'Z')) + > c ' = ' + %trimr(ds3MultJob) + > c '/' + %trimr(ds3MultUser) + '/' + > c ds3MultNbr > c Msg dsply > c enddo > > c dsply pause > > c return > >_______________________________________________ >This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing >list >To post a message email: MIDRANGE-L@midrange.com >To subscribe, unsubscribe, or change list options, >visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l >or email: MIDRANGE-L-request@midrange.com > Mike Naughton Senior Programmer/Analyst Judd Wire, Inc. 124 Turnpike Road Turners Falls, MA 01376 413-863-4357 x444 mnaughton@juddwire.com
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.