Solved

As400 - reports

Posted on 2013-05-10
9
100 Views
Last Modified: 2016-07-05
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.
0
Comment
Question by:Vsomepalli
  • 4
  • 3
9 Comments
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 39167840
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
0
 

Author Comment

by:Vsomepalli
ID: 39169234
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
0
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 39169500
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
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:Vsomepalli
ID: 39177446
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
0
 
LVL 34

Expert Comment

by:Gary Patterson
ID: 39177902
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
0
 

Author Comment

by:Vsomepalli
ID: 39178516
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
0
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 39179884
Venkat,

SCS spooled files, by default, contain SCS control codes, not ANSI FCFC control codes:

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzalu%2Frzaluscs.htm

Here is a table that lists the valid ANSI FCFC codes:

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzau6%2Frzau6ansi.htm

If desired, a programmer can choose to use ANSI FCFC codes in a program, but if so, must code explicitly to write the correct control code in the first byte of each row written to the printer file.  

If your programs aren't coded to do that (it is not a common RPG printing technique), then there ARE NO FCFC CODES IN THE SPOOLED FILE DATA - there are only SCS codes.

SCS codes are stored in the spooled output file.  If the file is printed on an SCS printer, then the spooled file data is sent intact.  If the file is printed on a non-SCS printer, the SCS codes are converted on the fly depending on the outq and or printer configuration.

So how do you get FCFC data if the program isn't coded to generate it?

Answer: You have to write a program or use a tool to create it yourself.

The most common way is to use the CPYSPLF command.  CPYSPLF can dynamically converts the SCS control codes it finds to ANSI FCFC codes - if you specify CTLCHAR(*FCFC).

You could certainly write a program to do the same thing yourself - and yes, RPG Open Access might be a nice way to do that.  I looked at the data available for Printer files in Open Access, and the QrnPrtctl_T data structure contains PRTCTL-style printer spacing control information.  

Looks like your HANDLER program will have to read the PRTCTL data structure for each row and convert it to FCFC.  You'll have to code that logic yourself in your RPG OA HANDLER program.

Refer to the Open Access manual for more information:

http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/books/rzasm.pdf

Of course, that is going to mean modifying every one of your report programs to add the HANDLER directive, but that is a lot better than some of the other options.

- Gary Patterson
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now