× 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.



As was already posted, you can use the QUSRJOBI API.
Check the QUSRJOBI copybook in QSYSINC/QCBLLESRC.

-----------------------------------------------------------------------
       identification division.
       program-id.    PC001R.
       author.        T. Winchester.
       date-written.  04/19/01.

¹     *---------------------------------------------------------------*
¹     * This program is an example of retrieving IP addresses in the  *
¹     * "dot" notation and launching a remote job (command) at a      *
¹     * workstation running Client Access on a TCP/IP network.        *
¹     *                                                               *
¹     * This could be used, for example, to launch WordPad, Excel,    *
¹     * or any other PC based Windoze applications.  In order to do   *
¹     * this, you must have the Client Access remote command daemon   *
¹     * running on the workstation.                                   *
¹     *                                                               *
¹     * In the NT/Win2000 world this runs as a service. In the Win95  *
¹     * and Win98 environments you must add CWBRXD to the STARTUP     *
¹     * group.  This is easily configured using the Client Access     *
¹     * Properties icon (see the Incomming Remote Command tab).       *
¹     *                                                               *
¹     * If everything is successful, then the desptop user will see   *
¹     * the WRITE program startup and there will be a QSYSPRT spool   *
¹     * created on the AS/400 indicating the PC command completed,    *
¹     * as follows:                                                   *
¹     *                                                               *
¹     *          "The remote command has produced no output."         *
¹     *                                                               *
¹     *---------------------------------------------------------------*
¹     *                                                               *
¹     * Guidelines to set up the remote command daemon on the PC can  *
¹     * be found at the Support Line Knowledge Base for Client Access *
¹     * at the following location.  Look under Client Access, Data    *
¹     * Access, Miscellaneous Functions (RUNRMTCMD) under the title   *
¹     *                                                               *
¹     *   "Initiating Data Transfers From an OS/400 Command Line      *
¹     *    Using Client Access Incoming Remote Command Service"       *
¹     *                                                               *
¹     * http://as400service.rochester.ibm.com/supporthome.nsf/        *
¹     * Document/10000051                                             *
¹     *                                                               *
¹     * Unwrap this direct link to take you right to it:              *
¹     *                                                               *
¹     * http://as400service.rochester.ibm.com/s_dir/slkbase.NSF       *
¹     * /515a7ef1f8deef8c8625680b00020380/26e8d8b78808bc4686256       *
¹     * 6ba00595402?OpenDocument                                      *
¹     *                                                               *
¹     *---------------------------------------------------------------*
       environment division.
       configuration section.
       input-output section.
       file-control.
¹     *----                                                     Printer
                   select ptofile    assign to printer-QPRINT.
       data division.
       file section.

       fd  ptofile.
       01  ptorecd.
           05  ptoline              pic  x(132).


       working-storage section.
¹     *---------------------------------------------------------------*
¹     *   Variables for the QUSRJOBI and QDCRDEVD system API's that   *
¹     *   retrieve the Internal Job-Id number and the IP address of   *
¹     *   the client currently signed onto the AS/400.                *
¹     *---------------------------------------------------------------*

       01  Qualified-Job-Name.
           05  Qual-JobName         pic  x(10)      value "*         ".
           05  Qual-UserId          pic  x(10)      value spaces.
           05  Qual-JobNbr          pic  x(06)      value spaces.
       01  Internal-Job-Identifier  pic  x(16)      value spaces.
       01  Format-Name              pic  x(08)      value spaces.
       01  Length-of-Receiver       pic s9(09)      value +0    binary.

¹     *---------------------------------------------------------------*
¹     *   Variables to hold the RUNRMTCMD and its length for QCMDEXC  *
¹     *   Note that the command string can be up to 1000 bytes long   *
¹     *   to compensate for those *long* directory paths :)           *
¹     *---------------------------------------------------------------*

       01  RunRmtCmd-Command        pic  x(256)     value spaces.
       01  RunRmtCmd-Length         pic s9(10)v9(5) value +0    comp-3.

¹     *---------------------------------------------------------------*
¹     * Note:  The following fields should be enclosed using single   *
¹     *        quotes in order for WinNT/Win2K to recognize them.     *
¹     *        Unfortunately, this only allows 8 character user-id's  *
¹     *        and passwords to be used on the PC side of the house   *
¹     *        since the RUNRMTCMD only permits 10 characters <sigh>. *
¹     *---------------------------------------------------------------*

       01  PC-User-Id               pic  x(10)      value "'userid  '".
       01  PC-Password              pic  x(10)      value "'password'".

¹     *---------------------------------------------------------------*
¹     * The following is an error code return data structure for APIs *
¹     *---------------------------------------------------------------*

                     copy qusec    of qsysinc-qcbllesrc.
           05  Exception-Data                      pic  x(00100).

¹     *---------------------------------------------------------------*
¹     *    Protoype for calling Retrieve Device Desc API QDCRDEVD     *
¹     *---------------------------------------------------------------*

                     copy qdcrdevd of qsysinc-qcbllesrc.

¹     *---------------------------------------------------------------*
¹     *   Protoype for calling Retrieve Job Information API QUSRJOBI  *
¹     *---------------------------------------------------------------*

                     copy qusrjobi of qsysinc-qcbllesrc.


       procedure division.
       000-main section.
       000-begin.

           open output ptofile.
¹     *----                                                Set-Up Parms
¹     *----                                                for QUSRJOBI
           move "JOBI0100"               to Format-Name.
           move length of QWC-JOBI0100   to Length-of-Receiver.
¹     *----                                            Get the Internal
¹     *----                                              Job-Id Number
           call "QUSRJOBI" using QWC-JOBI0100
                                 Length-of-Receiver
                                 Format-Name
                                 Qualified-Job-Name
                                 Internal-Job-Identifier
                                 QUS-EC.
¹     *----                                                      Error?
           if EXCEPTION-ID not = spaces
               move spaces               to ptoline
               move "02 QUSRJOBI error=" to ptoline (1:20)
               move EXCEPTION-ID         to ptoline (21:)
               write ptorecd after advancing 1 line
               go to 990goback
           end-if.
¹     *----                                                Set-up Parms
¹     *----                                                for QDCRDEVD
           move length of QDC-DEVD0600   to Length-of-Receiver.
           move "DEVD0600"               to Format-Name.
¹     *----                                             Get Device Info
¹     *----                                            (TCP/IP address)
           call "QDCRDEVD" using QDC-DEVD0600
                                 Length-of-Receiver
                                 Format-Name
                                 JOB-NAME of QWC-JOBI0100
                                 QUS-EC.
¹     *----                                                      Error?
           if EXCEPTION-ID not = spaces
               move spaces               to ptoline
               move "02 QDCRDEVD error=" to ptoline (1:20)
               move EXCEPTION-ID         to ptoline (21:)
               write ptorecd after advancing 1 line
               go to 990goback
           end-if.

¹     *---------------------------------------------------------------*
¹     * Build the RUNRMTCMD string in a character string. The TCP/IP  *
¹     * dotted address must NOT contain embedded spaces. To check the *
¹     * CCSID of the PC, open a DOS window and type CHCP. This will   *
¹     * provide the correct code-page number.                         *
¹     *---------------------------------------------------------------*

           string "RUNRMTCMD CMD('C:\WINNT\system32\write.exe')"
                                     delimited by size
                  " RMTLOCNAME('"    delimited by size
                  NETWORK-IP-ADDRESS-DOTTED-FMT of QDC-DEVD0600
                                     delimited by spaces
                  "' *IP) RMTUSER("  delimited by size
                  PC-User-Id         delimited by spaces
                  ") RMTPWD("        delimited by size
                  PC-Password        delimited by spaces
                  ") CCSID(437)"     delimited by size
                                     into RunRmtCmd-Command
           end-string.
¹     *----                                               Set-up length
¹     *----                                                for QCMDEXC
           move length of RunRmtCmd-Command to RunRmtCmd-Length.
¹     *----                                                    Execute
¹     *----                                                   RUNRMTCMD
           call "QCMDEXC" using RunRmtCmd-Command
                                RunRmtCmd-Length.

           close ptofile.

       990goback.

           goback.

       end program PC001R.
--------------------------------------------------------------------------

Terry


> -----Original Message-----
> From: Cesar Altamirano [mailto:cesaralt@viabcp.com]
> Sent: Wednesday, November 20, 2002 10:10 PM
> To: COBOL AS/400
> Subject: Job Parameters
>
>
> Hi,
> Is there any way or structure inside a COBOL program,
> to obtain the Job Name, User Name, Job Number, etc.
> like the SDS structure of an RPG program?
> I need to invoke a CL program from COBOL
> passing this parameters.
>
> Thanks for any Help.
> Regards,
> Caesar A.


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.