Link to home
Create AccountLog in
Avatar of Vsomepalli
Vsomepalli

asked on

As400 - reports

Hi,

In my application currently we are printing the reports in RPGLE using program described printer files concepts. once the reports are generated then we are copying spool file into physical file using CPYSPLF command with control as *FCFC.

now currently I am planning to build the reports into physical file member instead of generate spool file and copy the spool file. my intention is without changing the program logic i.e) instead of write the data into spool file , reroute printer data into physical file.

currently i didn't know how to route the printer data into physical file. the data in physical file should be as cpysplf command *FCFC way.

could you please help on me.
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

If you don't want to change the program, why don't you just do what you are currently doing, adding one step: deleting the spooled file.

Write to the printer file
Copy the spooled file to a database file
Delete the spooled file

The other option is to OVRDBF to a database file.  There are a few restrictions, and if you run into one you can just use the CPYSPLF and Delete technique,.

http://iprodeveloper.com/rpg-programming/faster-way-grab-print-file-data

- Gary Patterson

- Gary Patterson
Avatar of Vsomepalli
Vsomepalli

ASKER

Hi Patterson,

Thanks for help. but here the problem.

I am using OVRDBF command to write data into database file instead of printer file but i am missing the printer control characters ( i.e) *FCFC values in CPYSPLF command ) . I didn't want to change program logic. but using OVRDBF only but I need control characters.

Thanks,
Venkat
Venkat,

Unfortunately, I think you are at the mercy of the program that is doing the printing.

Programs can specify forms control information several different ways.  One of those ways is by putting an ANSI forms control character in the first byte of each row.  If that was happening, you'd see those in the first byte of the database file output when you do an OVRDBF.

Most programs don't generate FCFC, however.  So you are probably seeing something else, like SCS control codes.

I don't know of any better option than to override the spooled file to HOLD and use CPYSPLF and then DLTSPLF.

If isn't a great solution from a performance standpoint, but if you can't change the underlying program, I think it is probably tour best alternative.

I'm assuming this is an SCS print file.  IF it isn't you may have some other options.  What is the format of the spooled file you are capturing?

- Gary
Hi Gray,

Thanks for info.  But in my applications we have 100 programs to generate SCS printer files.

In my project, we are running batch process. In this batch process we are generating reports i.e) printer files. once report is generated then we are coping report into spool files into database file using CPYSPLF command.  due to above two steps the batch process running long time. so now I am thinking to remove the CPYSPLF execution i.e) redirecting printer data into disk file using OVRDBF. but once the program done, I am missing the *FCFC character.

Based on above solution if I need to get *FCFC then, I need to change 100 programs to write *FCFC character.

Could you please suggest the best solution.
Is any other way is their to capturing the printer using the RPG Open access then write data into disk file instead of printer file.
 

Thanks,
Venkat
Hi Venkat,

I can' think of a way to do this without changing all your programs.  Here's a suggestion, though:

If your problem is the long runtime, why not run the CPYSPLF processes in a separate job?

In your primary process, instead of issuing the CPYSPLF, create a data queue, and put an entry on the data queue containing the name of each spooled file you want to copy.  Start a second job that processes the data queue, which performs a CPYSPLF for each file it reads from the data queue.

Data queue "sends" and "receives" (QSNDDTAQ/QRCVDTAQ apis) are really fast, and this way your CPYSPLF operations can run in parallel with you main batch job.

If you are running on an old single-CPU system, or if your are running on a multi-CPU system that is CPU bound or I/O bound during your batch process, then this might not produce much overall runtime improvement.  On most systems, though, it will help a lot.

- Gary Patterson
Hi Gray,

Thanks for the help.  It will work. Instead of this RPG OA handler will work on printer file handler or not?   My idea is RPG OA handler capture the IO feedback so in case printer file if I capture the record data then I will include the *FCFC character then write data into disk file.
could you please let me know this solution will work or not.

Thanks,
Venkat
ASKER CERTIFIED SOLUTION
Avatar of Gary Patterson, CISSP
Gary Patterson, CISSP
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account