Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run A Program With A Display File In Batch 3

Status
Not open for further replies.

Skittle

ISP
Sep 10, 2002
1,528
US
I have a program that accepts a couple of paramarters at run time and populates a subfile. The subfile in then processed when a function key is pressed.

I now need the program to run in batch with the parameters passed to it. The subfile is central to the program processing and so rather than rewrite the program I tried
preventing the display of any screens and changing the program to accept parameters at the command line. This works well from the command line but if I submit the program in a batch job, it falls over immediatly because of course the display file s defined as a WORKSTN file.

Is there a way of getting round this? I need the program to run in batch with the subfile processing intact but I need to prevent the runtime error of a batchjob trying to open a workstn display file.




Dazed and confused
 
Hi Skittle,
Hmm... I do not like that.
However try to add USROPN on the WORKSTN F spec and don't open it when in batch mode. With no guarantee at all...
hth
 
Hmmm but I still have to open the file to use subfiles
so I think the problem will just occurr later. Will give it a try though.

Dazed and confused
 
This is what I think too... However give it a try to be sure, no risk to mess up this time.
 
I did this with a program once. I madt the display file Usropn and opened it only if the program had no parameters passed (%parms = 0). If %parms > 0, I bypassed the screen I/O and substituted the parameter values.

De mortuis nihil nisi bonum.

 
I've decided to bite the bullet. Under a lot of pressure so
I was looking to put this problem away quickly.

I just know that sooner or later somebody will want to run the program properly in a batch job so it makes more sense to sort it properly now.

I'm converting the subfile to a multi-ocurance data-structure.

Damn my conciencious professional pride!!



Dazed and confused
 
Congrats' You've made the right professional decision ! [medal]
 
I know....but there is a penalty....less time towards my MCAD preparation.

Hey ho. :eek:)





Dazed and confused
 
If your re-writing wouldnt a work file be better than a multi-occurance data structre as you wont have the potential to over run the number of elements ?

 
When you have a program with a display file that you also want to submit to batch at times, you need to change the display file to be controlled as a User Open:
FDISPLAY CF E WorkStn UsrOpn

If you are unfamiliar with this, you will need to open and close the file yourself with the Open and Close OpCodes, rather than allowing the RPG program to automatically take care of this housekeeping when you initiate a program and closing it when you set on *INLR.

You can easily determine whether a job is interactive with the CL command RTVJOBA TYPE(&Type), where 0 shows that it is running in batch, though an API can also be used.
Marilyn
eisinger2@hotmail.com
 
...I was right . Today the FD walked in and wants to use my batch program for more varints of the same sort of thing. Glad I did it right. Saved me time in the end.

Dazed and confused
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top