Return to the Systems Tips
Retrieve all IP addresses who have a job in a subsystem
Is there a way to retrieve all IP addresses who have a job in a subsystem (QINTER for example).
100/*********************************************************************/ 200 /* Retrieve/display TCP/IP addresses for pass-through devices */ 300 /*********************************************************************/ 400 /* */ 500 /* Check for / install these PTFs or supercedes on your system */ 600 /* to get support for the additional fields in the QDCRDEVD API */ 700 /* DEVD0600 format: */ 800 /* */ 900 /* OS/400 V3R2 LICPGM 5763SS1 PTF SF44503 */ 1000 /* OS/400 V3R7 LICPGM 5716SS1 PTF SF44312 */ 1100 /* */ 1200 /* Additional information about these PTFs (cover letters) can be */ 1300 /* found at IBM's web site: */ 1400 /* */ 1500 /* www.as400service.ibm.com */ 1600 /* */ 1700 /* For additional information about the QDCRDEVD API, see the IBM */ 1800 /* manual "OS/400 Configuration APIs" */ 1900 /*********************************************************************/ 2000 /* Copyright (c) Craig Pelkie, 1997 */ 2100 /* ALL RIGHTS RESERVED */ 2200 /* */ 2300 /* Craig Pelkie */ 2400 /* Bits & Bytes Programming */ 2500 /* PO Box 1473 */ 2600 /* Valley Center, CA 92082-1473 */ 2700 /* craig@ca400.com */ 2800 /*********************************************************************/ 2900 3000 rtvtcpaddr: pgm 3100 3200 dcl &bytesprov *char 4 /* Bytes Provided */ + 3300 value(x'00000010') /* 16 byte structure*/ 3400 dcl &ctld *char 10 /* Controller desc */ 3500 dcl &devnam *char 10 /* Device name */ 3600 dcl &error *char 16 /* Error field */ 3700 dcl &msg *char 150 /* Displayed msg */ 3800 dcl &port *dec len(5 0) /* Port number */ 3900 dcl &portbin *char 2 /* Port (binary) */ 4000 dcl &portchar *char 5 /* Port number */ 4100 dcl &protocol *char 1 /* Network protocol */ + 4200 value(x'02') /* TCP/IP protocol */ 4300 dcl &rcvvar *char 1024 /* Receiver var */ 4400 dcl &rtvdev *char 10 /* Dev to retrieve */ 4500 dcl &rtvdevno *dec len(4 0) /* Device number */ 4600 dcl &rtvdevnoc *char 4 /* Device number */ 4700 dcl &tcpaddr *char 15 /* TCP/IP address */ 4800 4900 /*********************************************************************/ 5000 /* Initialize "bytes provided" subfield in Error Code structure */ 5100 /*********************************************************************/ 5200 5300 chgvar %sst(&error 1 4) value(&bytesprov) 5400 5500 /*********************************************************************/ 5600 /* Create pass-through device ID in loop. Start at 'QPADEV0001', */ 5700 /* end after 'QPADEV0250'. This is incremented in the loop. */ 5800 /*********************************************************************/ 5900 6000 chgvar &rtvdevno 0 6100 6200 loop: 6300 6400 chgvar &rtvdevno value(&rtvdevno + 1) 6500 if (&rtvdevno *gt 250) then(return) 6600 6700 chgvar &rtvdevnoc &rtvdevno 6800 chgvar &rtvdev value('QPADEV' *cat &rtvdevnoc) 6900 7000 /*********************************************************************/ 7100 /* Call the Retrieve Device Description API, format DEVD0600 */ 7200 /* to retrieve information about selected device */ 7300 /*********************************************************************/ 7400 7500 chgvar &rcvvar ' ' 7600 7700 call qdcrdevd parm( + 7800 &rcvvar /* Receiver variable */ + 7900 x'00000400' /* Length of &rcvvar (1024)*/ + 8000 'DEVD0600' /* Format to receive */ + 8100 &rtvdev /* Device ID to retrieve */ + 8200 &error) /* Error field */ 8300 8400 /*********************************************************************/ 8500 /* Extract values from receiver variable if retrieved device */ 8600 /* is a TCP/IP device (position 859, network protocol = x'02') */ 8700 /*********************************************************************/ 8800 8900 chgvar &devnam %sst(&rcvvar 22 10) 9000 9100 if (&devnam *eq ' ') then(return) 9200 9300 if ((%sst(&rcvvar 859 1) *ne &protocol)) + 9400 then(goto loop) 9500 9600 chgvar &ctld %sst(&rcvvar 205 10) 9700 chgvar &portbin %sst(&rcvvar 860 2) 9800 chgvar &port %bin(&portbin) 9900 chgvar &portchar &port 10000 chgvar &tcpaddr %sst(&rcvvar 877 15) 10100 10200 /*********************************************************************/ 10300 /* Format/display message */ 10400 /*********************************************************************/ 10500 10600 chgvar &msg value( + 10700 ' Device: ' *cat &devnam *tcat + 10800 ' Controller: ' *cat &ctld *tcat + 10900 ' Port: ' *cat &portchar *tcat + 11000 ' Address: ' *cat &tcpaddr) 11100 11200 sndpgmmsg msg(&msg) topgmq(*same) 11300 goto loop 11400 11500 endpgm 11600
[report a broken link by clicking here]