× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: How do I determine if my RPGLE program is running in batch orinteractive mode?
  • From: tomh@xxxxxxxxx
  • Date: Mon, 16 Apr 2001 17:53:01 -0500


Thanks, Scott - that works _perfectly_!  My boss is going to think I'm some sort of friggin' programming genius - one of these days, I may clue him into this discussion list....

Naaahhh....




Scott Klement <klemscot@klements.com>
Sent by: owner-rpg400-l@midrange.com

04/16/01 04:36 PM
Please respond to RPG400-L

       
        To:        RPG400-L@midrange.com
        cc:        
        Subject:        Re: How do I determine if my RPGLE program is running in batch or interactive mode?





On Mon, 16 Apr 2001 tomh@simas.com wrote:

> Is there some way for me to determine if my RPGLE program is running in
> batch or interactive mode, from within the program itself?

There's an API that'll do this.   The API is "QUSRJOBI" (Retrieve Job
Information).   The way I handled this was to create a simple "IsIntJob"
(Is interactive job?) procedure, and throw it into a "tools" service
program.

Here's the subprocedure that I use, along with a quick example:

     D IsIntJob        PR             1N
    D Msg             S             50A

     c                   if        IsIntJob
    c                   eval      Msg = 'Interactive job'
    c                   dsply                   Msg
    c                   else
    c                   eval      Msg = 'Non-interactive job.'
    c     Msg           dsply
    c                   endif

     c                   eval      *inlr = *on


      *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
     *   IsIntJob   --   Is this an interactive job?
     *        returns *ON if job is interactive
     *            or  *OFF if job is not interactive.
     *+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    P IsIntJob        B                   export
    D IsIntJob        PI             1N

     D QUSRJOBI        PR                  EXTPGM('QUSRJOBI')
    D   RcvVar                   32766A   options(*varsize)
    D   RcvVarLen                   10I 0 const
    D   Format                       8A   const
    D   QualJob                     26A   const
    D   InternJob                   16A   const
    D   ErrorCode                32766A   options(*nopass:*varsize)

     D dsJob           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

     c                   callp     QUSRJOBI(dsJob: %size(dsJob): 'JOBI0100':
    c                                   '*': *blanks)
    c                   if        dsJobType = 'I'
    c                   return    *ON
    c                   else
    c                   return    *OFF
    c                   endif
    P                 E



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.