Create a list of printers with IP/DNS in AS/400

15 pts.
Tags:
AS/400
CL Program
I need to pullout the doc for all printers name and its IP/Dns in an AS/400 box. Instead of collecting it manually as it takes lots of time, do I have any CL program to collect or any kind of job available for it. Please advise.
0

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Splat
    Here's what I use - you'll likely need to make some changes for your situation:

    /*===================================================================*/
    /*                                                                   */
    /*===================================================================*/
    /*                                                                   */
     START:      PGM
    
    
     F010:       DCLF       FILE(QaDspObj)
    
                 Dcl        Var(&MsgId) Type(*CHAR) Len(7)
                 Dcl        Var(&MsgDta) Type(*CHAR) Len(256)
                 Dcl        Var(&MsgF) Type(*CHAR) Len(10)
                 Dcl        Var(&MsgFLib) Type(*CHAR) Len(10)
    
                 Monmsg     MsgId(CPF0000 MCH0000 RPG0000) Exec(Goto +
                              CmdLbl(End))
    
    
     F020:       CRTDUPOBJ  OBJ(QADSPOBJ) FROMLIB(*LIBL) OBJTYPE(*FILE) +
                              TOLIB(QTEMP)
                 MONMSG     MSGID(CPF2130)
    
                 CHGPF      FILE(QTEMP/QADSPOBJ) MAXMBRS(*NOMAX) +
                              SIZE(*NOMAX)
    
                 ADDPFM     FILE(PRINT132) MBR(PRINTERS)
                 MONMSG     MSGID(CPF7306) EXEC(DO)
                  CLRPFM     FILE(PRINT132) MBR(PRINTERS)
                 ENDDO
    
    
     F030:       DSPOBJD    OBJ(*ALL/*ALL) OBJTYPE(*DEVD) +
                              OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPOBJ) +
                              OUTMBR(PRT00000)
                 MONMSG     MSGID(CPF0000)
    
                 OVRDBF     FILE(QaDspObj) TOFILE(QTEMP/QaDspObj) +
                              MBR(PRT00000) SECURE(*YES) SHARE(*YES)
    
                 OPNQRYF    FILE((QTEMP/QaDspObj PRT00000))               +
                            QRYSLT('((OdObTp *EQ "*DEVD"))')              +
                            KEYFLD((OdLbNm)                               +
                                   (OdObNm))                              +
                            OPNID(Query_0001)
    
    
     F040:       RCVF       RCDFMT(QLidObjD)
                 MONMSG     MSGID(CPF0864) EXEC(Do) /* end of file */
                  CLOF       OPNID(QUERY_0001)
                  DLTOVR     FILE(QADSPOBJ)
                  GOTO       CMDLBL(F050)
                 ENDDO
    
                 IF         COND(&OdObTp *NE '*DEVD') THEN(GOTO +
                              CMDLBL(F040))
    
                 IF         COND((%SST(&ODOBNM 1 3) *NE 'PRT') *AND +
                              (%SST(&ODOBNM 1 3) *NE 'RMT')) THEN(GOTO +
                              CMDLBL(F040))
    
                 DSPDEVD    DEVD(&ODOBNM) OUTPUT(*PRINT)
    
                 CPYSPLF    FILE(QPDCDEV) TOFILE(*CURLIB/PRINT132) +
                              SPLNBR(*LAST) TOMBR(PRINTERS) MBROPT(*ADD)
    
                 DLTSPLF    FILE(QPDCDEV) SPLNBR(*LAST)
    
                 GOTO       CMDLBL(F040)
    
    
     F050:       CALL       PGM(PRT00001)
    
    
                 Return
    
     End:        RcvMsg     MsgType(*EXCP) MsgDta(&MsgDta) MsgId(&MsgId) +
                              MsgF(&MsgF) MsgFLib(&MsgFLib)
    
                 DmpClPgm
    
                 SndPgmMsg  MsgId(&MsgId) MsgF(&MsgFLib/&MsgF) +
                              MsgDta(&MsgDta) MsgType(*ESCAPE)
    
                 EndPgm
    Which calls:
         H datedit(*mdy) datfmt(*iso) debug timfmt(*hms)
         H dftactgrp(*no) actgrp('HSGRP')
         H expropts(*resdecpos)
         H option(*srcstmt: *nodebugio)
         H bnddir('UTILITIES')
         H* ============================================================================================
    
          * ============================================================================================
    
         FPrint132  Ip   e             Disk    rename(print132: print132f)
    
         FPrt00001p0O    e             Printer oflind(*in99)
         F                                     usropn
    
    
          /copy WRHS_Copy,APIerr_D
          /copy WRHS_Copy,Pssr_d
          /copy WRHS_Copy,Utility_D
          /copy WRHS_Copy,API_D
    
    
         D Valid           S               n
    
    
         IPrint132f     01
         I              print132                    record
    
    
          * ============================================================================================
          * Normal detail cycle
          * ============================================================================================
    
    b001 C                   If        *in01
    b002 C                   If        %subst(record: 41: 4) = 'DEVD'
     002 C                   Eval      device = %subst(record  : 53: 10)
    e002 C                   EndIf
    
    b002 C                   If        %subst(record: 41: 10) = 'RMTLOCNAME'
     002 C                   Eval      valid = *on
    e002 C                   EndIf
    
    b002 C                   If        valid and
     002 C                             %subst(record: 4: 34) =
     002 C                                      'Name or address  . . . . . . . . :'
     002 C                   Eval      address = %subst(record: 53: 15)
    e002 C                   EndIf
    
    b002 C                   If        valid and
     002 C                             %subst(record: 41: 4) = 'TEXT'
     002 C                   Eval      text = %trim(%subst(record: 53))
    
     002 C                   Exsr      Print_01
     002 C                   Write(e)  Print00001
    
     002 C                   Eval      valid = *off
    e002 C                   EndIf
    e001 C                   EndIf
    
    
    
          * ============================================================================================
          * End of program
          * ============================================================================================
    b001 Clr                 If        %open(prt00001p0)
     001 Clr                 Write(e)  Print09999
     001 Clr                 Close     prt00001p0
    e001 Clr                 EndIf
    
    
    
          * ============================================================================================
    
          * All subroutines
    
          * Print_01   - Print
    
          * ============================================================================================
    
          * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
          * Print_01   - Print
          * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
         Csr   Print_01      BegSr                                                  Print_01
    
    b001 Csr                 If        not %open(prt00001p0)
     001 Csr                 Open      prt00001p0
     001 Csr                 Eval      *in99 = *on
    e001 Csr                 EndIf
    
    b001 Csr                 If        *in99
     001 Csr                 Write(e)  Print00000
     001 Csr                 Eval      *in99 = *off
    e001 Csr                 EndIf
    
    
         Csr                 EndSr                                                  Print_01
    
    
          /copy WRHS_Copy,Pssr_C
    
    
    

    12,895 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: