Bulk AS400 CL comands

I am using the Copy File (CPYF) command to copy records from a local file to a remote DDm file. There are a total of 50 files I have to access 10 remote boxes and multiple libraries. is there any way I can put this multiple CL commands in a srcfile and run them as a batch job...and if so could you please give me a example of the syntax I am new to AS400.

CPYF   FROMFILE(QGPL/AUTO)  TOFILE(DDMLIB1/RMTCAR)
CPYF   FROMFILE(QGPL/AUTO)  TOFILE(DDMLIB2/RMTCAR)
CPYF   FROMFILE(QGPL/AUTO)  TOFILE(DDMLIB3/RMTCAR)
LVL 1
slimcutter2kAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

daveslaterCommented:
Hi

If you canrun the CL statements from a source file using SBMDBJOB.

there is a good example of  a source file in
qsql/QSQSAMP   member setup


Another way is via a CL program

you can enter all the copies thike this


PGM


CPYF   FROMFILE(QGPL/AUTO)  TOFILE(DDMLIB1/RMTCAR)
CPYF   FROMFILE(QGPL/AUTO)  TOFILE(DDMLIB2/RMTCAR)
CPYF   FROMFILE(QGPL/AUTO)  TOFILE(DDMLIB3/RMTCAR)

ENDPGM

Compile it then


calll mypgm

Do you need detailed instructions


Dave
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
slimcutter2kAuthor Commented:
Thanks, I'm going to try it now. The main question I had was how to format it. I know when you do multiple SQL statements they have to be separated with an ";" I was just wondering if there was a similar rule or if u could just take all the commands you wanted to run.


I see you have specified "Pgm" entered your Commands. And than "ENDPGM

Can you provide detailed instructions on both methods? I have the jest of what you saying but I just want to make sure I do everything correct. I have another question about bulk updates using a simular method but I will submit another question.
0
Mind_nlCommented:
first entry in your program source will be PGM and the last entry will be ENDPGM in between these lines you can just enter your commands as they are accepted on a normal command line, new line for each command no sepperator like ';' is needed
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

slimcutter2kAuthor Commented:
will the soruce file hav a type of CL?
0
daveslaterCommented:
Hi
there should be a source file in QGPL called QCLSRC
use PDM to access this

Strpdm

option 1 work with members
qclsrc
qgpl

use F6 to create the member, call it what you, the type will default and enter some text

enter the copy copy commands

F3 to exit and save

option 14 to compile.

It's as easit as that.

I will need to look at the other oprion - my 400 is dowing it's backup and I can not get access from home.

dave
0
slimcutter2kAuthor Commented:
It Worked! Thanks For the Help.            


ENDPGM


I added MBROPT(*ADD)  and also FMTOPT(*NOCHK)  the files have the same sucture but there is no data in the to file.


now

0
daveslaterCommented:
Hi slimcutter2k
Now that you have the basic program working it’s time to make it more robust.

CL has a command MONMSG.

This allows you to monitor for an OS message that a command generate.s and will stop you CL program from crashing.

The MONMSG can be either global – defined like this

PGM

MONMSG CPF0000

Copy
Copy
Copy


ENDPGM

Or defined for a specific statement define as

PGM

Copy
MONMSG CPF0000

Copy
MONMSG CPF0000

Copy
MONMSG CPF0000

ENDPGM.

Have look into it

Dave

PS
MONMSG CPF0000 is a catch all message that will capture any message.
by looking at the help on a specific command it normall shows the messages that can be issued.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
IBM System i

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.