ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

example QUSRJOBI is job batch or interactive?

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

  • example QUSRJOBI is job batch or interactive?

    Used to identify job as batch or interactive.
    This way you can use the same program with display to submit
    itsself to batch with parms supplied by the screen.

    PHP Code:
    ~
          *
          *--------------------------------------------------------
         
    fSOMEDSP   cf   e             workstn
          
    *
          * 
    Variable Definition
          
    *
         
    d Format          s              8
         d RcvVarLen       s             10i 0

         d dsJobDta        ds
         d  dsJobBytesRtn                10I 0
         d  dsJobBytesAvl                10I 0
         d  dsJobName                    10A
         d  dsJobUser                    10A
         d  dsJobNumber                   6A
         d  dsJobIntern                  16A
         d  dsJobStatus                  10A
         d  dsJobType                     1A
         d  dsJobSubtype                  1A
         d  dsJobReserv1                  2A
         d  dsJobRunPty                  10I 0
         d  dsJobTimeSlc                 10I 0
         d  dsJobDftWait                 10I 0
         d  dsJobPurge                   10A

          
    //
          //  external calls
          //

         
    d $jobinfo        pr                  extpgm('QUSRJOBI')
         
    d   DsJob                             like(DsJobDta)
         
    d   Length                      10i 0 const
         
    d   APIFormat                    8    const
         
    d   ApiJob                      26    const
         
    d   InternJob                   16    const


          /
    Free

            
    //--------------------------------------------------------
            // MAIN PROGRAM
            //--------------------------------------------------------

                
    exsr  Hskpg;


                 *
    inlr = *on;

            
    //--------------------------------------------------------
            // Hskpg - one time run subroutine
            //--------------------------------------------------------

                 
    begsr Hskpg;


                  
    // determine if this job is interactive or batch

                       
    RcvVarLen = %Size(DsJobDta);
                       
    Format 'JOBI0100';

                      
    $jobinfo(dsjobdta rcvvarlen Format '*' ' ');

                         if 
    DSJOBTYPE 'I';
                           if 
    not%open(SOMEDSP);
                             
    open SOMEDSP;
                           endif;
                         else;
                           
    // do batch stuff
                         
    endif;



                 
    endsr;
          /
    End-Free

    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
Working...
X