Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Reading DEVD files

319 views
Skip to first unread message

jerry chapman

unread,
Jul 3, 2007, 6:20:29 AM7/3/07
to
Could someone outline how I could read all the DEVD's on my machine and
write the output to a file? I assume I could use a combination of c and cl.


jacko

unread,
Jul 3, 2007, 6:33:12 AM7/3/07
to
On Jul 3, 6:20 am, "jerry chapman" <jerryc...@sbcglobal.net> wrote:
> Could someone outline how I could read all the DEVD's on my machine and
> write the output to a file? I assume I could use a combination of c and cl.

You could use CL, do a DSPOBJD on all the *DEVD's to an outfile then
RPG it or Query it or download it into excel etc.

jerry chapman

unread,
Jul 3, 2007, 6:45:50 AM7/3/07
to
Could you give me an example of a DSPOBJD command that sends a DEVD to a
file?
"jacko" <jkin...@cityofnorthport.com> wrote in message
news:1183458792....@q69g2000hsb.googlegroups.com...

tomasz

unread,
Jul 3, 2007, 6:48:16 AM7/3/07
to
jerry chapman napisał(a):

You can do:
DSPOBJD OBJ(*ALL) OBJTYPE(*DEVD) OUTPUT(*OUTFILE) OUTFILE(QTEMP/FILE)

Regards,
Tomasz

jerry chapman

unread,
Jul 3, 2007, 7:29:56 AM7/3/07
to
I created a file with your suggestion, but when I look at the file I dont
see an IP Address. I see the DEVD name and the text description, and a lot
of entries with *SYSBAS. The data doesn't look at all like what I see when I
do a DSPDEVD command.
"tomasz" <t...@nospam.com> wrote in message
news:f6d9j2$40s$1...@atlantis.news.tpi.pl...

jerry chapman

unread,
Jul 3, 2007, 8:05:38 AM7/3/07
to
What I want is to create a text file that contains one line for each DEVD,
and that line should have three entries -- the Device description, Remote
location: name or address and Text value.
"jerry chapman" <jerr...@sbcglobal.net> wrote in message
news:Kqqii.313$m%.175@newssvr17.news.prodigy.net...

tomasz

unread,
Jul 3, 2007, 8:23:43 AM7/3/07
to
jerry chapman napisał(a):

Hi.
I would write a CL to make DSPOBJD OBJ(*ALL) OBJTYPE(*DEVD) to outfile.
And then another part of CL would read from that outfile names of DEVD
which are DSPVRT type and make DSPDEVD for that specific device names.
Result can be write into file or spoolfile.

Regards,
Tomasz

walker.l2

unread,
Jul 3, 2007, 9:18:33 AM7/3/07
to
DSPOBJD *OUTFILE looks like the best way to get the list of DEVDs
(there doesn't seem to be a good API to get this), but I would go for
an API to get the DEVD information itself - QDCRDEVD seems to be the
one for that.

The output requirements make this look like a job for a proper HLL
(e.g. RPG or COBOL) program rather than CL.

jerry chapman

unread,
Jul 3, 2007, 11:48:30 AM7/3/07
to
I tried QDCRDEVD and got a command not found error. Is there a particular
library I need to point to?
"walker.l2" <walk...@ukonline.co.uk> wrote in message
news:1183468713....@k29g2000hsd.googlegroups.com...

"René H. Hartman"

unread,
Jul 3, 2007, 11:55:37 AM7/3/07
to
Try and get some training. What I see here are more and more clueless
cheapo's that are hired by Scroogy employers and then come here to pick
the brains of the professionals whose jobs they take.

--
Vriendelijke groeten / Best regards,

René H. Hartman
www.hac-maarssen.nl

CRPence

unread,
Jul 3, 2007, 12:03:29 PM7/3/07
to
Although a *CMD object could be considered effectively to be an API
[some limited to only CLP and REXX], the reference to an Application
Programming Interface would normally refer to a program or a module in a
service program. Search or navigate the Programming section in the
InfoCenter for the API name QDCRDEVD for how to use that program; there
will be references on the web as well.

Regards, Chuck
--
All comments provided "as is" with no warranties of any kind
whatsoever and may not represent positions, strategies, nor views of my
employer

Thomas Raddatz

unread,
Jul 3, 2007, 12:10:59 PM7/3/07
to jerry chapman
Jerry,

QDCRDEVD is an API and not a command. You have to call it like any other program and pass a specific
parameter list to it:


/* --------------------------------------------------------------- */
/* - Variable declarations - */
/* --------------------------------------------------------------- */

Dcl &RcvVar *Char ( 892 )
Dcl &RcvVarLen *Char ( 4 ) ( X'0000037C' )
Dcl &Format *Char ( 8 ) ( 'DEVD0600' )
Dcl &DevD *Char ( 10 )
Dcl &APIError *Char ( 8 ) ( X'0000000000000000' )
Dcl &IPAddr *Char ( 15 )

/* --------------------------------------------------------------- */
/* - Retrieve current device name and its dotted IP address - */
/* --------------------------------------------------------------- */

ChgVar VAR(&DevD) VALUE('theNameOfTheDeviceGoesHere')

Call QDCRDEVD +
( &RcvVar +
&RcvVarLen +
&Format +
&DevD +
&APIError )

ChgVar &IPAddr ( %Sst( &RcvVar 878 15 ) )


Thomas Raddatz.

jerry chapman schrieb:

jerry chapman

unread,
Jul 3, 2007, 11:36:03 PM7/3/07
to
I compiled and ran the listing you sent. It got an error, and when I looked
in QEZJOBLOG it said 6 parameters were supplied when 5 were required. I
don't see how 6 were supplied.

"Thomas Raddatz" <thomas....@tools400.de> wrote in message
news:468A7513...@tools400.de...

jerry chapman

unread,
Jul 4, 2007, 4:12:37 AM7/4/07
to
I changed DEVD0600 to DEVD1100 (since I am looking at type *PRT) and the
program ran without error. How can I display the value for IPAddr or write
it somewhere?

"jerry chapman" <jerr...@sbcglobal.net> wrote in message
news:rAEii.471$m%.169@newssvr17.news.prodigy.net...

walker.l2

unread,
Jul 4, 2007, 4:36:52 AM7/4/07
to
According to the InfoCenter: http://publib.boulder.ibm.com/infocenter/iseries/v5r3/index.jsp
it is right there in the DEVD1100 at offset 1404.

jerry chapman

unread,
Jul 4, 2007, 10:35:02 AM7/4/07
to
Yes, I see that, but how can print it to the screen or write it to a file?

"walker.l2" <walk...@ukonline.co.uk> wrote in message
news:1183538212.2...@q69g2000hsb.googlegroups.com...

Thomas Raddatz

unread,
Jul 4, 2007, 12:23:51 PM7/4/07
to jerry chapman
Jerry,

>> I compiled and ran the listing you sent. It got an error, and when I looked
>> in QEZJOBLOG it said 6 parameters were supplied when 5 were required. I

It should not make any difference whether you call the program with format 'DEVD0600' or 'DEVD1100'.
Hence I do not understand why you get that error message when using format 'DEVD0600'. The program
just runs fine when I compile and call it. I used option 14 to compile that CLLE program:

Pgm

Dcl &RcvVar *Char ( 892 )
Dcl &RcvVarLen *Char ( 4 ) ( X'0000037C' )
Dcl &Format *Char ( 8 ) ( 'DEVD0600' )
Dcl &DevD *Char ( 10 )
Dcl &APIError *Char ( 8 ) ( X'0000000000000000' )
Dcl &IPAddr *Char ( 15 )

ChgVar Var(&DevD) VALUE('W001001701')

Call QDCRDEVD +
( &RcvVar +
&RcvVarLen +
&Format +
&DevD +
&APIError )

ChgVar &IPAddr ( %Sst( &RcvVar 878 15 ) )

SNDPGMMSG MSGID(CPF9897) MSGF(QCPFMSG) +
MSGDTA('IP-Addr:' *BCAT &IPAddr) +
TOPGMQ(*PRV (*CTLBDY))

EndPgm

Here is what I would do if I was you:

1. Do a DSPOBJD OBJ(*ALL) OBJTYPE(*DEVD) OUTPUT(*OUTFILE) OUTFILE(QTEMP/OBJD)

Check if it is possible to recognize the device descriptions you need from what is written to OBJD. I
guess that you can use ODOBAT for that purpose. Since we do not have any remote printers (just remote
OUTQs) I can not be more specific.

2. Given that you can recognize the device descriptions you need, continue with this:

2.1 Write a CL that does the DSPOBJD to an output file in QTEMP.
2.2 Call a RPGLE program that opens the output file in QTEMP for UPDATE!
You can use the EXTFILE keyword to specify the file in QTEMP.
2.3 Read each entry and delete every non printer device description.
2.4 For each printer device description:
Call QDCRDEVD with format DEVD1100 to get its IP address.
Put the IP address into ODLBL and update the record.

jerry chapman

unread,
Jul 4, 2007, 1:06:15 PM7/4/07
to
I just found a much easier way to get the data I want. I first do a wrkdevd,
and do an option 9 on all my printers (they all start with PRT), which
creates an entry in QCLSRC for each printer.. On my PC I use OOREXX to write
a program which will FTP the source for each of my printers, and write out
the fields I need (device name, IP address and text value).

"Thomas Raddatz" <thomas....@tools400.de> wrote in message
news:468BC997...@tools400.de...

walker.l2

unread,
Jul 5, 2007, 5:17:11 AM7/5/07
to
Okay, but don't rely on option 9 producing the same output on every
version of OS/400.

Jonathan Ball

unread,
Jul 5, 2007, 11:04:13 AM7/5/07
to
jerry chapman wrote:
> I created a file with your suggestion, but when I look at the file I dont
> see an IP Address. I see the DEVD name and the text description, and a lot
> of entries with *SYSBAS. The data doesn't look at all like what I see when I
> do a DSPDEVD command.

Try the QDCRDEVD API.

Thomas Raddatz

unread,
Jul 6, 2007, 1:18:59 AM7/6/07
to
You are right. However option 9 produces a command string and I do not expect that IBM will ever
change the keyword of the IP address.

Thomas.

walker.l2 schrieb:

0 new messages