Progress/400
Product Guide
Preparing Progress 4GL Procedures for the AS/400
This section provides guidelines for preparing 4GL code for use on the AS/400. Topics covered include removing user-interface statements, using aliases, and file input and output.
Removing User-interface Statements
Because the native clients do not provide any screen-oriented display capabilities, you must make sure that your application output is redirected to a file or printer with the OUTPUT TO statement. Use the remote client’s Procedure Editor to edit your p-code and redirect any output. See "Common Product Information," for additional guidelines.
Using Aliases
When using DEFINE ALIAS so that r-code can be run against multiple databases, you must define two aliases, as follows:
File Input and Output
Applications must use either the QSYS.LIB file system or IFS file system syntax when performing file input and output, as the following sections describe.
INPUT FROM and OUTPUT TO Commands
Because the native clients do not have interactive capabilities, you must explicitly define your input and output streams with Progress statements. You cannot default to the terminal for input and output as you would with an interactive Progress procedure. The INPUT FROM and OUTPUT TO commands in your native client applications behave the same as the standard Progress 4GL with the exception of the interactive capability.
To provide a location for the input and output that you generated with the client code on the AS/400, you must indicate a file using INPUT FROM and OUTPUT TO. The syntax that you use when specifying a file depends on the file system that you are using on the AS/400.
Table 5–3 gives examples of the syntax for INPUT FROM in the QSYS.LIB file system or the ROOT file system under IFS.
When you specify INPUT FROM ’/QSYS.LIB/*LIBL.LIB/P.FILE/MYFILE.MBR’, Progress/400 searches for the file/member in the current library list. If multiple files of the same name exist in different libraries, Progress/400 uses the first file it finds. If the file is not found in the library list, Progress/400 writes an error to your job log.
It is important to note that the INPUT FROM command does not use PROPATH to search for files. Progress/400 does, however, search the *LIBL and *CURLIB for a file when you specify these library lists.
Table 5–4 gives examples of the syntax for OUTPUT TO in the QSYS.LIB and ROOT file system under the IFS.
OUTPUT TO Rules
The following list describes the behavior of the OUTPUT TO command:
- *CURLIB.lib — With the OUTPUT TO statement, if you specify OUTPUT TO ‘/QSYS.LIB/*CURLIB.LIB/P.FILE/MYFILE.MBR’, Progress/400 writes MYFILE.MBR to wherever *CURLIB is defined. If a current library is not set in the library list for the job, or if the current library is set but the file does not exist, Progress/400 writes an error to the job log.
- Library explicitly stated — With the OUTPUT TO statement, where a library, file, or member is explicitly stated but does not exist, Progress/400 creates a library and file as a source physical file with a record length of 144, and a member within the source file.
- End of record — The OUTPUT TO statement uses stream input and output to write data for both ROOT and QSYS.LIB file systems. Since stream files do not use end-of-record, QSYS.LIB files are not truncated at the end of a record. Instead, the output wraps into the next record.
- Stream file format — If you specify a physical file member in the QSYS.LIB library file system as the destination of an OUTPUT TO statement, the formatting can be confusing. Data written to this file is output in stream file format. You must convert your data to a record format if you want to view it with the QSYS.LIB file system.
- Record file format —To convert stream data to the record-oriented format of the QSYS.LIB file system, follow these steps:
- Execute the CPYFRMSTMF command. The file you specified on the OUTPUT TO statement in your 4GL maps to the FROMSTMF parameter of the command.
NOTE: Using command defaults for the ENDLINFMT parameter can result in extra carriage returns and line feeds that fragment the data. This is the default behavior in IFS when the FROMSTMF parameter specifies a file from the QSYS.LIB file structure. The ENDLINFMT selection is not necessary when FROMSTMF parameter is from the IFS file structure instead.- Select your desired record file member name in the TOMBR parameter. You must also select the *LF value for the ENDLINFMT parameter {ENDLINFMT(*LF)}.
Output to Printer
When you direct output to a printer, OS/400 writes the output to a spooled file and places it in an output queue. The characteristics of the spooled file are controlled by the AS/400 printer file. The AS/400 printer file determines such things as the page size and the number of lines per page for printed output. Progress/400 supports a printer file called PROPRTF, which resides in the Progress/400 executables library. The PROPRTF printer file uses most of the OS/400 command defaults for print files including the default page size, font, page rotation, and number of copies. It also uses the default printer device and output queue associated with the job that executes the Progress procedure. The PROPRTF printer file differs from the AS/400 printer file defaults for the following attributes:
You can override the default characteristics of the PROPRTF print file, or direct the output to a different printer by using the OVRPRTF command. If you do override the printer default, you must make sure the PRTF attributes are set for the new printer.
Additionally, you can direct output to a specific printer file by providing the printer name as an argument to the OUTPUT TO statement. Any printer file you specify must contain the attributes assigned in the PRTF printer file.
Note that if you output to a printer using PUT UNFORMATTED, unpredictable results can occur. The Progress 4GL does not have any knowledge of the AS/400 print control. The 4GL programmer must manage print control.
Another option for specifying your own printer file is using the
-o
parameter. The Progress statement OUTPUT TO PRINTER automatically uses the correct attributes for you when you use the Printer (-o
) parameter.NOTE: Blank lines from your print file are not visible when viewed from an output queue. Printed output contains the proper spacing.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |