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 <a href="http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fapis%2Fqwclscde.htm">List Job Schedule Entries (QWCLSCDE) API</a> 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.
Tom
Last Wiki Answer Submitted: November 26, 2010 10:41 am by TomLiotta110,135 pts.
All Answer Wiki Contributors: TomLiotta110,135 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
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.
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
enddo
/* 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 )
enddo
Clean_up:
return
endpgm
The program
Creates a user space,
List the job scheduler into the user space,
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.)
Then in a loop for each list element…
Retrieves individual job scheduler entry name and date,
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.
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.
If you save/restore the scheduler object, it is object QDFTJOBSCD in library QUSRSYS, object type *JOBSCD.
Tom
Iam new to API, how do we execute the QLCLSCDE API inorder to view the entries.
Johnson
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.
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 enddo /* 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 ) enddo Clean_up: return endpgmThe program
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
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
Here’s a similar issue:
http://itknowledgeexchange.techtarget.com/itanswers/transfering-saverestore-job-scheduler-from-one-as400-to-another/
I included the code I use to transfer over the Advanced Job Scheduler.