Automate CPYSPLF

Hi all. We are trying to automate a CPYSPLF command using a CLP. The issue that we are having is that we can not get the appropriate job info for the spoolfile. The name is unique but there may be multiple files in the outq. Can someone help us with some sample code? We are on V5R3 and do not have the IBM APIs installed (that I know of). We also have a COBOL compiler but no RPG compiler.

Thank you in advance..

Mitch
LVL 1
mcs1169Asked:
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 Mitch
I am sure that V5R3 comes with all languages as standard (I am sure Tom will correct me on that if I am wrong).
The API's are part of the OS and will be on the box.

Yout have the *LAST option for a copy spool file so you can easily do
CPYSPLF FILE(MYSPLF) TOFILE(MYDB) SPLNBR(*LAST)
you can the delete using
dltsplf and the *LAST option
to copy the spool files in reverse order

If you can be more specific on how many spool files you want to copy, are they generated by the same job, etc.. We can help a bit more

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
odumbruceCommented:
I have a rpg program that makes use of the API's your welcome to and can try to translate it to cobol.  The API's will be on your system they are parto f the operating system. if you


                                                 
 Spooled file . . . . . . . . . .                
 To data base file  . . . . . . .                
   Library  . . . . . . . . . . .     *LIBL      
 Job name . . . . . . . . . . . .   *            
   User . . . . . . . . . . . . .                
   Number . . . . . . . . . . . .                
 Spooled file number  . . . . . .   *LAST        
0
odumbruceCommented:
Sorry for the prev post finger hit enter.  I have a rpg program that makes use of the API's your welcome to and can try to translate it to cobol.  The API's will be on your system they are parto f the operating system. if you use RTVJOBA you can get the JOB USER and number and like dave stated you use the *LASR for the spooled file number and you will always get the last print for that job.  See below

Spooled file . . . . . . . . . .                
 To data base file  . . . . . . .                
   Library  . . . . . . . . . . .     *LIBL      
 Job name . . . . . . . . . . . .   *            
   User . . . . . . . . . . . . .                
   Number . . . . . . . . . . . .                
 Spooled file number  . . . . . .   *LAST        
0
tliottaCommented:
Yes... #1. If you have any licensed language such as COBOL, you also may install similar languages such as RPG for no additional cost. RPG might not be installed yet, but it should be installable from your CD. If you also have any licensed tool such as SEU, then you also have all tools at no additional cost. This means VisaulAge for RPG, CODE/400, etc. Again, the code might not yet be installed, but it ought to be on your CDs. If you have COBOL, then there's no need for RPG. I'm not aware of any function that's not available to all the licensed languages. ILE CL (and REXX) are the non-licensed languages that can't always access every API, primarily due to no pointer support.

#2. The only APIs I could think might not be installed would be some that were specific to environments such as QShell or PASE. I don't actually know if that's true, but I've never needed an API that wasn't available. I suspect you'll always know ahead of time if you need to install options such as those, so I wouldn't be concerned that any APIs weren't in the base system.

#3. You _might_ get some ideas by studying examples. I've got one at < http://zap.to/tl400 > -- Look in the Files section under Age Spool Files. It's a basic procedure for listing all spooled files on the system (from *ALL outqs) and aging them. Ones that are deemed too old are moved to outqs that regularly get cleared. It's pretty old but does the job and shows various spooled file functions. It's written in CL but could be fairly directly translated to any other language once it's understood.

Tom


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.