ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

moving spool files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Re: moving spool files

    Originally posted by Piper View Post
    You must be talking about the RPG piece. The only trim I am missing is on my '67 Coronet lol

    so you can't really pass a CL varible to a RPG huh?

    I tried adding this line to the above CL pgm makes sense in theory

    CALL MOVEOUTQ PARM('PIPER' 'PIPEROUTQ' 'PROD' '(&OUTQ))'

    &outq being the current days outq.
    yep i'm talking about the RPG...why trim a constant that has no blanks...

    try this in your CL
    Code:
    CALL MOVEOUTQ PARM('PIPER' 'PIPEROUTQ' 'PROD' &OUTQ)
    when you wrap the variable in quotes guess what the RPG is getting? it receives the constant '(&OUTQ) not the value of the &OUTQ variable.

    passing parameters to RPG works the same as passing parameters to a CL

    HTH
    I'm not anti-social, I just don't like people -Tommy Holden

    Comment


    • #17
      Re: moving spool files

      it does help, i don't get to do a lot of banging around with programs so I am having a blast..thanks
      Piper with the Camden County Emerald Society Pipes and Drums
      Check us out
      http://www.ccespd.org

      The Dodge Coronet Registry
      http://www.dodgecoronet.com

      Comment


      • #18
        Re: moving spool files

        hey piper:

        Jamie gave you this:
        Code:
        call moveoutq parm('JAMIELIB' 'JAMIEOUT' 'JAMIELIB' 'JJFOUTQ')
        Those 4 parms correspond to this code:
        Code:
         
             d MOVEOUTQ        pr
             d  [COLOR=blue]inFlibrary[/COLOR]                   10
             d  [COLOR=blue]inFoutq  [/COLOR]                    10
             d  [COLOR=blue]inTlibrary[/COLOR]                   10
             d  [COLOR=blue]inToutq[/COLOR]                      10
         
             d MOVEOUTQ        pi
             d  [COLOR=blue]inFlibrary[/COLOR]                   10
             d  [COLOR=blue]inFoutq[/COLOR]                      10
             d  [COLOR=blue]inTlibrary[/COLOR]                   10
             d  [COLOR=blue]inToutq[/COLOR]                      10
        Just add your new parm
        Code:
        call moveoutq parm('JAMIELIB' 'JAMIEOUT' 'JAMIELIB' 'JJFOUTQ' '[COLOR=red]010108[/COLOR]')
         
             d MOVEOUTQ        pr
             d  [COLOR=blue]inFlibrary[/COLOR]                   10
             d  [COLOR=blue]inFoutq  [/COLOR]                    10
             d  [COLOR=blue]inTlibrary[/COLOR]                   10
             d  [COLOR=blue]inToutq[/COLOR]                      10
             d  [COLOR=red]mydate[/COLOR]                        6
        for now hard code today's date in the cl and see if you can work out where to add the code in the rpg.

        Let us know
        GLS
        Last edited by GLS400; June 17, 2008, 01:48 PM.
        The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

        Comment


        • #19
          Re: moving spool files

          sorry...we are experiencing at&t line problems..
          my access to the web is hit or miss [mostly MISS] till they repair.

          okay here is the source and the compiled program...

          it must be RPGLE ....

          ftp the save file into an already existing savf file on the
          iseries...

          then resore to QTEMP and have at it!

          Tom its old code cobbled together.........you get what you get

          Jamie
          Attached Files
          All my answers were extracted from the "Big Dummy's Guide to the As400"
          and I take no responsibility for any of them.

          www.code400.com

          Comment


          • #20
            Re: moving spool files

            Originally posted by jamief View Post
            Tom its old code cobbled together.........you get what you get

            Jamie
            LOL not really a valid argument...a constant with no blanks shouldn't be trimmed in any version of any language
            I'm not anti-social, I just don't like people -Tommy Holden

            Comment


            • #21
              Re: moving spool files

              let me download this and take a wack at it....because my code right about now looks like this
              Attached Files
              Piper with the Camden County Emerald Society Pipes and Drums
              Check us out
              http://www.ccespd.org

              The Dodge Coronet Registry
              http://www.dodgecoronet.com

              Comment


              • #22
                Re: moving spool files

                I am different from most people....It takes me some time to learn stuff.
                then once its in a program...I just cut and paste...I know better today, but yesterday I did not...for that I am so sorry
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #23
                  Re: moving spool files

                  i appreciate all the help believe me, my old man told me you have to make a lot of mistakes and trial and errors but keep at something you'll learn it


                  yeah..thanks to having an LPAR with a TEST box as well lmao
                  Last edited by Piper; June 17, 2008, 02:40 PM.
                  Piper with the Camden County Emerald Society Pipes and Drums
                  Check us out
                  http://www.ccespd.org

                  The Dodge Coronet Registry
                  http://www.dodgecoronet.com

                  Comment


                  • #24
                    Re: moving spool files

                    piper also look at this to get julian date for outq...your outq must start with a
                    letter so I placed a "Q" in front.. you can just add to the moveoutq program.

                    Code:
                     *                                                                           
                    d myoutq          s             10                                           
                    d julian          s               d   datfmt(*JUL) inz                       
                     *                                                                           
                     *========================================================================   
                     * MAIN LINE                                                                 
                     *========================================================================   
                     *                                                                           
                    c                   eval      julian = %date()                               
                    c                   eval      myoutq = 'Q' + %char(julian:*jul0)             
                     *                                                                           
                    c                   eval      *inlr = *on
                    All my answers were extracted from the "Big Dummy's Guide to the As400"
                    and I take no responsibility for any of them.

                    www.code400.com

                    Comment


                    • #25
                      Re: moving spool files

                      now its popping a RNQ0222

                      I'll have at it again tommorrow, I learned some stuff today so thanks for posting
                      Last edited by Piper; June 17, 2008, 03:04 PM.
                      Piper with the Camden County Emerald Society Pipes and Drums
                      Check us out
                      http://www.ccespd.org

                      The Dodge Coronet Registry
                      http://www.dodgecoronet.com

                      Comment


                      • #26
                        Re: moving spool files

                        bleh, forget about the caps UPPER...ok worked then I tried to pop in that extra code Jamie just posted, its bombing on the compile, I must not have it in the right spot
                        Piper with the Camden County Emerald Society Pipes and Drums
                        Check us out
                        http://www.ccespd.org

                        The Dodge Coronet Registry
                        http://www.dodgecoronet.com

                        Comment


                        • #27
                          Re: moving spool files

                          put the d specs up at the top with the rest of them "d" specs & put the c with the c specs.

                          jamie
                          All my answers were extracted from the "Big Dummy's Guide to the As400"
                          and I take no responsibility for any of them.

                          www.code400.com

                          Comment


                          • #28
                            Re: moving spool files

                            the * is just commenting out a line then I take it?
                            Piper with the Camden County Emerald Society Pipes and Drums
                            Check us out
                            http://www.ccespd.org

                            The Dodge Coronet Registry
                            http://www.dodgecoronet.com

                            Comment


                            • #29
                              Re: moving spool files

                              yes sir....exactly scan for "here PIPER"
                              Code:
                              À     *=======================================================================                     Ä
                              À     * Program Name: MOVEOUTQ                                                                     Ä
                              À     * Description : Read thru outqueue move spooled files if ITSTATUS in                         Ä
                              &#192;     *               ITOUTQP <> *Blanks                                                           &#196;
                              &#192;     * Written On  :                                                                              &#196;
                              &#192;     *                                                                                            &#196;
                              &#192;     *                                                                                            &#196;
                              &#192;     * Modification                                                                               &#196;
                              &#192;     * ~~~~~~~~~~~~                                                                               &#196;
                              &#192;     * Date             Project Pgmr Description                                                  &#196;
                              &#192;     * ~~~~~~~~         ~~~~~~~ ~~~~ ~~~~~~~~~~~                                                  &#196;
                              &#192;     *June 22,2004                                                                                &#196;
                              &#192;     *                                                                                            &#196;
                              &#192;     *========================================================================                    &#196;
                                   h option(*srcstmt: *nodebugio)  dftactgrp(*no)
                              
                                     //
                                     //  entry plist
                                     //
                              
                                   d MOVEOUTQ        pr
                                   d  inFlibrary                   10
                                   d  inFoutq                      10
                                   d  inTlibrary                   10
                                   d  inToutq                      10
                              
                                   d MOVEOUTQ        pi
                                   d  inFlibrary                   10
                                   d  inFoutq                      10
                                   d  inTlibrary                   10
                                   d  inToutq                      10
                              
                              &#192;     *                                                                                            &#196;
                              &#192;     * Program Info                                                                               &#196;
                              &#192;     *                                                                                            &#196;
                                   d PgmInfo        SDS
                                   d  @PgmName               1     10
                                   d  @Parms                37     39  0
                                   d  @MsgID                40     46
                                   d  @JobName             244    253
                                   d  @UserId              254    263
                                   d  @JobNbr              264    269  0
                              &#192;     *                                                                                            &#196;
                              &#192;     * API - List spooled files                                                                   &#196;
                              &#192;     *                                                                                            &#196;
                                   d QUSLSPL         PR                  extpgm('QUSLSPL')
                              &#192;     * required parameters                                                                        &#196;
                                   d   UsrSpc                      20A   const
                                   d   Format                       8A   const
                                   d   UserName                    10A   const
                                   d   QualOutQ                    20A   const
                                   d   FormType                    10A   const
                                   d   UserData                    10A   const
                              &#192;     * optional group 1:                                                                          &#196;
                                   d   ErrorCode                32766A   options(*nopass: *varsize)
                              &#192;     * optional group 2:                                                                          &#196;
                                   d   QualJob                     26A   options(*nopass) const
                                   d   FieldKeys                   10I 0 options(*nopass: *varsize)
                                   d                                     dim(9999)
                                   d   NumFields                   10I 0 options(*nopass) const
                              &#192;     * optional group 3:                                                                          &#196;
                                   d   AuxStgPool                  10I 0 options(*nopass) const
                              &#192;     * optional group 4:                                                                          &#196;
                                   d   JobSysName                   8A   options(*nopass) const
                                   d   StartCrtDate                 7A   options(*nopass) const
                                   d   StartCrtTime                 6A   options(*nopass) const
                                   d   EndCrtDate                   7A   options(*nopass) const
                                   d   EndCrtTime                   6A   options(*nopass) const
                              &#192;     *                                                                                            &#196;
                                   d QUSCRTUS        PR                  extpgm('QUSCRTUS')
                                   d   UsrSpc                      20A   const
                                   d   ExtAttr                     10A   const
                                   d   InitialSize                 10I 0 const
                                   d   InitialVal                   1A   const
                                   d   PublicAuth                  10A   const
                                   d   Text                        50A   const
                                   d   Replace                     10A   const
                                   d   ErrorCode                32766A   options(*nopass: *varsize)
                              &#192;     *                                                                                            &#196;
                                   d QUSPTRUS        PR                  extpgm('QUSPTRUS')
                                   d   UsrSpc                      20A   const
                                   d   Pointer                       *
                              &#192;     *                                                                                            &#196;
                                   d QUSDLTUS        PR                  extpgm('QUSDLTUS')
                                   d   UsrSpc                      20A   const
                                   d   ErrorCode                32766A   options(*varsize)
                              &#192;     *                                                                                            &#196;
                                   d p_UsrSpc        s               *
                                   d dsLH            DS                   based(p_UsrSpc)
                                   d                                      qualified
                                   d   Filler1                    103A
                                   d   Status                       1A
                                   d   Filler2                     12A
                                   d   HdrOffset                   10I 0
                                   d   HdrSize                     10I 0
                                   d   ListOffset                  10I 0
                                   d   ListSize                    10I 0
                                   d   NumEntries                  10I 0
                                   d   EntrySize                   10I 0
                              &#192;     *                                                                                            &#196;
                                   d p_Entry         s               *
                                   d dsSF            DS                   based(p_Entry)
                                   d                                      qualified
                                   d   JobName                     10A
                                   d   UserName                    10A
                                   d   JobNumber                    6A
                                   d   SplfName                    10A
                                   d   SplfNbr                     10I 0
                                   d   SplfStatus                  10I 0
                                   d   OpenDate                     7A
                                   d   OpenTime                     6A
                                   d   Schedule                     1A
                                   d   SysName                     10A
                                   d   UserData                    10A
                                   d   FormType                    10A
                                   d   OutQueue                    10A
                                   d   OutQueueLib                 10A
                                   d   AuxPool                     10I 0
                                   d   SplfSize                    10I 0
                                   d   SizeMult                    10I 0
                              &#192;     *                                                                                            &#196;
                                   d   TotalPages                  10I 0
                                   d   CopiesLeft                  10I 0
                                   d   Priority                     1A
                                   d   Reserved                     3A
                              &#192;     *                                                                                            &#196;
                                   d dsEC            DS                  qualified
                                   d  BytesProvided                10I 0 inz(&#37;size(dsEC))
                                   d  BytesAvail                   10I 0 inz(0)
                                   d  MessageID                     7A
                                   d  Reserved                      1A
                                   d  MessageData                 240A
                              &#192;     *                                                                                            &#196;
                              &#192;     * constants                                                                                  &#196;
                              &#192;     *                                                                                            &#196;
                                   d MYSPACE         c                   const('SPLFLIST  QTEMP     ')
                                   d Low             c                   const('abcdefghijklmnopqrstuvwxyz')
                                   d Up              c                   const('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
                              &#192;     *                                                                                            &#196;
                              &#192;     *  Field Definitions.                                                                        &#196;
                              &#192;     *                                                                                            &#196;
                                   d OutQName        ds
                                   d   OutQ                        10A   inz(*blanks)
                                   d   OutQLib                     10A   inz(*blanks)
                              &#192;     *                                                                                            &#196;
                                   d size            s             10I 0
                                   d sf              s             10I 0 inz(1)
                                   d pos             s              4  0
                                   d pos1            s              4  0
                                   d Len             s              4  0
                                   d Loop            s              1    inz('Y')
                              &#192;     *                                                                                            &#196;
                                   d CmdString       s            256    inz(*blanks)
                                   d CmdLength       s             15  5 inz(0)
                              &#192;     *                                                                                            &#196;
                              &#192;     * here PIPER                                                                                 &#196;
                                   d myoutq          s             10
                                   d julian          s               d   datfmt(*JUL) inz
                              &#192;     *                                                                                            &#196;
                                   d IFSPDFName      s           2500    inz(*blanks)
                                   d IFSHTMName      s           2500    inz(*blanks)
                                   d JobInfo         s            256    inz(*blanks)
                                   d IFSFName        s            256    inz(*blanks)
                                   d FTPFName        s            256    inz(*blanks)
                                   d wSPLFName       s             10    inz(*blanks)
                                   d wJobName        s             10    inz(*blanks)
                                   d wUserData       s             10    inz(*blanks)
                                   d EMLSubject      s            256    inz(*blanks)
                                   d EMLMessage      s          15000    inz(*blanks)
                                   d EMLAddress      s            256    inz(*blanks)
                              &#192;     *                                                                                            &#196;
                              &#192;     *========================================================================                    &#196;
                              &#192;     * MAIN LINE                                                                                  &#196;
                              &#192;     *========================================================================                    &#196;
                              &#192;     * here PIPER                                                                                 &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   eval      julian = %date()
                                   c                   eval      myoutq = 'Q' + %char(julian:*jul0)
                              
                              &#192;     *                                                                                            &#196;
                              &#192;     *  Read thru the ITOUTQ table and look for ITSTATUS <> *Blanks                               &#196;
                              &#192;     * If found then use the To-OutQueue and Library to move the spooled Files                    &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   eval      OutQ    = infoutq
                                   c                   eval      OutQLib = inflibrary
                                   c                   exsr      $GetSPLFList
                              &#192;     *                                                                                            &#196;
                                   c                   eval      *inlr = *on
                                   c                   return
                              &#192;     *========================================================================                    &#196;
                              &#192;     * $GetSPLFList - Get Spooled File List                                                       &#196;
                              &#192;     *========================================================================                    &#196;
                                   c     $GetSPLFList  begsr
                              &#192;     *                                                                                            &#196;
                              &#192;     * set this to zero to let OS/400 handle errors                                               &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   eval      dsEC.BytesProvided = 0
                              &#192;     *                                                                                            &#196;
                              &#192;     * Make space for (approx) 1000 spooled files to be listed                                    &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   eval      size = %size(dsLH) + 512 +
                                   c                                    (%size(dsSF) * 1000)
                              &#192;     *                                                                                            &#196;
                              &#192;     * Create a user space                                                                        &#196;
                              &#192;     * List spooled files to the user space                                                       &#196;
                              &#192;     * Get a pointer to the returned user space                                                   &#196;
                              &#192;     *                                                                                            &#196;
                                    /free
                                       // Create a user space
                                       QUSCRTUS(MYSPACE: 'USRSPC': size: x'00': '*ALL':
                                        'Temp User Space for QUSLSPL API':  '*YES': dsEC);
                              
                                       // List spooled files to the user space
                                       QUSLSPL(MYSPACE: 'SPLF0300': '*ALL': OutQName:
                                          '*ALL': '*ALL': dsEC);
                              
                                       // Get a pointer to the returned user space
                                       QUSPTRUS(MYSPACE: p_UsrSpc);
                                    /end-free
                              &#192;     *                                                                                            &#196;
                              &#192;     * Loop through list, for each spooled file, display the                                      &#196;
                              &#192;     * Status: 1=RDY , 2=OPN, 3=CLO, 4=SAV, 5=WRT, 6=HLD,                                         &#196;
                              &#192;     *         7=MSGW, 8=PND, 9=PRT,10=FIN,11=SND,12=DFR                                          &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   eval      p_Entry = p_UsrSpc + dsLH.ListOffset
                                   c                   eval      sf = 1
                                   c                   dow       sf <= dsLH.NumEntries
                              &#192;     *                                                                                            &#196;
                              &#192;     * currently only move status = 1 ready                                                       &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   if        dsSF.SplfStatus = 1
                                   c                   exsr      $MoveSplf
                                   c                   endif
                              &#192;     *                                                                                            &#196;
                                   c                   eval      p_Entry = p_Entry + dsLH.EntrySize
                                   c                   eval      sf = (sf + 1)
                                   c                   enddo
                              &#192;     *                                                                                            &#196;
                              &#192;     * delete user space                                                                          &#196;
                              &#192;     *                                                                                            &#196;
                                    /free
                                        QUSDLTUS(MYSPACE: dsEC);
                                    /end-free
                              &#192;     *                                                                                            &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   endsr
                              &#192;     *========================================================================                    &#196;
                              &#192;     * $MoveSplF  - Move the spooled file                                                         &#196;
                              &#192;     *========================================================================                    &#196;
                                   c     $MoveSPlf     begsr
                              &#192;     *                                                                                            &#196;
                                   c                   eval      JobInfo =
                                   c                             %trim(dsSF.JobNumber) +
                                   c                             %trim('/') + %trim(dsSF.UserName) +
                                   c                             %trim('/') + %trim(dsSF.JobName)
                              &#192;     *                                                                                            &#196;
                                   c                   eval      wSPLFName = dsSF.SplfName
                                   c                   eval      wJobName  = dsSF.JobName
                                   c                   eval      wUserData = dsSF.UserData
                              &#192;     *                                                                                            &#196;
                              &#192;     * Move the spool file                                                                        &#196;
                              &#192;     * CHGSPLFA FILE(QPSUPRTF) JOB(546777/FLANARY/QPADEV0041)                                     &#196;
                              &#192;     * SPLNBR(*LAST) CRTDATE(*LAST)  OUTQ(JAMIELIB/JAMIEOUT)                                      &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   eval      CmdString =  'CHGSPLFA' +
                                   c                             ' FILE(' + %trim(wSPLFName)+ ')'+
                                   c                             ' JOB('  + %trim(JobInfo) + ')'+
                                   c                             ' SPLNBR(' +
                                   c                             %trim(%char(dsSF.SplfNbr)) + ')'   +
                                   c                             ' OUTQ(' + %Trim(intlibrary)  + '/' +
                                   c                             %trim(intoutq)  + ')'
                              
                                   c                   eval      CmdString = %xlate('~' : ' ' : CmdString)
                              &#192;     *                                                                                            &#196;
                              &#192;     * Do the actual move of the spooled file                                                     &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   eval      Len = %len(%trim(CmdString))
                              &#192;     *                                                                                            &#196;
                                   c                   call(e)   'QCMDEXC'
                                   c                   parm                    CmdString
                                   c                   parm      Len           CmdLength
                              &#192;     *                                                                                            &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   endsr
                              &#192;     *========================================================================                    &#196;
                              &#192;     * Initialization                                                                             &#196;
                              &#192;     *========================================================================                    &#196;
                                   c     *inzsr        begsr
                              &#192;     *                                                                                            &#196;
                              &#192;     *                                                                                            &#196;
                                   c                   endsr
                              All my answers were extracted from the "Big Dummy's Guide to the As400"
                              and I take no responsibility for any of them.

                              www.code400.com

                              Comment


                              • #30
                                Re: moving spool files

                                very cool, it compiled! Ok without me googling it, what is a D spec/ C spec
                                Piper with the Camden County Emerald Society Pipes and Drums
                                Check us out
                                http://www.ccespd.org

                                The Dodge Coronet Registry
                                http://www.dodgecoronet.com

                                Comment

                                Working...
                                X