Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Bulk AS400 CL comands

Posted on 2004-11-09
7
Medium Priority
?
1,416 Views
Last Modified: 2012-06-27
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)
0
Comment
Question by:slimcutter2k
  • 3
  • 3
7 Comments
 
LVL 14

Accepted Solution

by:
daveslater earned 2000 total points
ID: 12537900
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
 
LVL 1

Author Comment

by:slimcutter2k
ID: 12539076
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
 
LVL 3

Expert Comment

by:Mind_nl
ID: 12539178
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 1

Author Comment

by:slimcutter2k
ID: 12539258
will the soruce file hav a type of CL?
0
 
LVL 14

Expert Comment

by:daveslater
ID: 12539373
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
 
LVL 1

Author Comment

by:slimcutter2k
ID: 12539585
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
 
LVL 14

Expert Comment

by:daveslater
ID: 12549670
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

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The deadly train derailment that occurred recently in DuPont, Washington, raises a lot of questions. It was a new route, the first trip tested with passengers, and the train was travelling at 50 mph over the zone’s speed limit. Could IoT play a role…
How do you create a user-centered user experience on your website? And what are some things you should consider in the process?
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question