Restore Job Schedule entry to iSeries box.

AS/400 FTP
AS/400 jobs
How to restore or FTP the Job Schedule Entries (only certain nos) from one iSeries Server to another iSeries Server? Thanks in advance.

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can’t FTP the job scheduler object from one system to another because FTP only transfers files, and the scheduler object isn’t a file. You can save the object into a savefile and FTP that, but it will transfer the entire object; the restore will restore the entire scheduler.

If you want to transfer only certain entries, use the List Job Schedule Entries (QWCLSCDE) API to list the entries into a user space. Process the list to choose which entries that you want to transfer. Store those into a file that you can FTP. Then read the file on the other system and run ADDJOBSCDE for each entry.

If you’d prefer, you could send a remote ADDJOBSCDE command and add the entry remotely so you don’t need a file nor FTP. Send the remote commands while processing the list in the user space.


Discuss This Question: 6  Replies

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.
  • TomLiotta
    If you save/restore the scheduler object, it is object QDFTJOBSCD in library QUSRSYS, object type *JOBSCD. Tom
    125,585 pointsBadges:
  • JohnsonMumbai
    Iam new to API, how do we execute the QLCLSCDE API inorder to view the entries. Johnson
    1,480 pointsBadges:
  • WoodEngineer
    If there only a few job schedule entries it will be faster to re-enter instead of writing a program. Working with APIs can be a bit challenging at first. Check out the user written CPYJOBSCDE. We have been using it for quite a while with good success. I do not remember where we got it. I think it was published in one of the AS/400 magazines. It is also available from TAA tools. This command will not copy a job schedule entry from one machine to another. It is used to create a new job schedule entry based on one already on your computer. I'd be happy to send you the code if you like. Its one command and one CLP.
    8,225 pointsBadges:
  • TomLiotta
    Here's a basic example of the QWCLSCDE API in a CL program followed by a real short description:
    pgm     ( +
       dcl    &qtemp           *char      10     value( 'QTEMP' )
       dcl    &qusrspc         *char      20
       dcl    &ErrCod          *char       4
       dcl    &us_hdr          *char     150   /* Space header      */
    /* This is a general-purpose field to hold objlck data...           */
       dcl    &us_obje         *char     108   /* A single entry    */
    /* General fields for RUSGENHDR...                                  */
       dcl    &offslst         *int
       dcl    &nbrlste         *int
       dcl    &sizlste         *int
       dcl    &us_name         *char      10     value( 'LSTSCDE' )
       dcl    &scd_Job         *char      10
       dcl    &scd_Date        *char      10
       chgvar             &qusrspc            ( &us_name *cat &qtemp )
       call    QUSCRTUS   ( +
                            &qusrspc                +
                            'TMPLST    '            +
                            x'00001000'             +
                            X'00'                   +
                            '*ALL      '            +
                            'Temp list scheduler    ' +
                            '*YES      '            +
                            x'0000000000000000'     +
       call    QWCLSCDE   ( +
                            &qusrspc                +
                            'SCDL0100'              +
                            '*ALL      '            +
                            '                '      +
                            x'0000000000000000'     +
    /*  Retrieve the initialization data...                             */
       call    QUSRTVUS   ( +
                            &qusrspc                +
                            x'00000001'             +
                            x'00000096'             +
                            &us_hdr                 +
       chgvar             &offslst        %bin( &us_hdr    125 4 )
       chgvar             &nbrlste        %bin( &us_hdr    133 4 )
       chgvar             &sizlste        %bin( &us_hdr    137 4 )
       if  ( &nbrlste *eq 0 )     do
          sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                       msgdta( 'No objects listed' )
          goto   Clean_up
    /* Set the offset to the list within the space...            */
       chgvar             &offslst            ( &offslst + 1 )
    /* Entries have been placed in the *usrspc for every objlck on the  */
    /*  named lib. We can now loop through to see if any locks are      */
    /*  held by another job...                                          */
    /* Start retrieval of objlck entries from the *usrspc...            */
       dountil  ( &nbrlste *le 0 )
          call    QUSRTVUS   ( +
                               &qusrspc                +
                               &offslst                +
                               &sizlste                +
                               &us_obje                +
       /* Extract job info from list entry...                       */
          chgvar          &scd_Job        %sst( &us_obje     2  10 )
          chgvar          &scd_Date       %sst( &us_obje    22  10 )
          sndpgmmsg   msgid( CPF9897 )       +
                        msgf( QSYS/QCPFMSG ) +
                        msgdta(              +
                                'Processing' *bcat +
                                &scd_Job     *bcat +
                                &scd_Date          +
                              )              +
                        topgmq( *ext ) +
                        msgtype( *diag )
    /* Perform loop testing...                                   */
          chgvar          &nbrlste            ( &nbrlste - 1 )
          chgvar          &offslst            ( &offslst + &sizlste )
    The program
    1. Creates a user space,
    2. List the job scheduler into the user space,
    3. Retrieves list header info from the space to get the number of entries in the list, the size of each entry and the offset into the space for the start of the list. (The offset is zero-based, so we add (1) to it for CL processing.)
    4. Then in a loop for each list element...
    5. Retrieves individual job scheduler entry name and date,
    6. And sends a message with name and date.
    If you call the program from a QCMD command line, the messages will be detailed messages in the joblog. About all the program really is is calling one API after the other. IBM API documentation explains each of the APIs, but if you have questions about any point, don't hesitate to ask. The program only pulls two of the attributes out of each entry. You can pull all of the attributes for each entry and string them to gether to make a ADDJOBSCDE command. That can be sent to the remote system with SBMRMTCMD or RUNRMTCMD or written to file that you transfer to the other system. Compile the example and run it. Learn what it does so you can use any of its pieces in other programs in the future. Start adding pieces to extract more attributes for the entries until you have all of the ones you need -- one attribute at a time until you feel comfortable. Or look at how it works and convert it to RPG or your favorite language. Tom
    125,585 pointsBadges:
  • TomLiotta
    Oh, and I just noticed that I left a bunch of old comments in the code. I cloned parts of a couple other programs to make the example. I was removing comments but I obviously got distracted and didn't finish cleaning it up. The various "list" APIs all work almost the same way with user spaces. The user space APIs are almost the same in every program. So when you need a new program, you copy an old one and replace the "list" API. In this case, I replaced the "list object locks" API with the "list job scheduler" API. Sometimes you don't replace the API. Instead, you change the format used by the API. This example asks for format ‘SCDL0100′. You might choose to change that to format ‘SCDL0200′. The API documentation tells you if one format gives everything you need. BTW, if you copy/paste the code, paste it into something like Notepad first. This editor doesn't handle simple apostrophes. It changes them into leading/trailing single-quotes. You'll want to use Find/Replace in Notepad (or whatever you use) to change those all back to simple apostrophes. Tom
    125,585 pointsBadges:
  • slack400
    Here's a similar issue: I included the code I use to transfer over the Advanced Job Scheduler.
    2,740 pointsBadges:

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.


Share this item with your network: