ADELIA |
VADELIA |
SADELIA |
WADELIA |
EADELIA |
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(B) (S) |
Warning
Concerning Visual Adelia programs :
"OPEN ViewName" must be used only in the server side,
"OPEN LayoutCode" must be used only in the client side.
Concerning Event Adelia programs :
"OPEN ViewName" must be used only in the server side,
"OPEN LayoutCode" is not compatible.
Section for use
All
Syntax
OPEN ViewName
OPEN LayoutCode PrinterNum
PrinterNum |
→ |
1 | 2 | 3 | ... | 9 | None |
Description
This instruction opens layout or database files for each program.
For a VADELIA batch program with a report, the number of the printer PrinterNum can be specified; otherwise the printer number 1 will be used by default.
For a WADELIA batch program, PrinterNum is forbidden.
File opening and closing operations are managed implicitly by Adelia.
If you need to manage file and layout opening and closing operations manually, you must modify the default generation options, specifying that you want to manage file opening operations, or specify the OPEN parameter when using the DEFINE_VIEW or VIEW instructions to make declarations.
As a result, the program will not automatically open and close the file at the start and end of its execution, enabling you to manage these operations as required.
If the generation options have been modified to request confirmation before opening a file, you can use AS/400 commands (OPNDBF, etc.) to open the file.
It is also possible to use these instructions without modifying the generation options. In this case, you must naturally use "CLOSE ViewName" before "OPEN ViewName".
Warning: With screen layouts, "OPEN LayoutCode" is ignored by the C generator and cannot be used with interactive VADELIA programs.
When it concerns a report template, the OPEN instruction updates the reserved word *RETURN_CODE:
- If it succeeds, the reserved word takes the *NORMAL value.
If it fails, the possible values are dependent on the type of report and generation platform. Only the combination of the Windows generation platform and a Crystal Reports report delivers significant error values, with other combinations returning a generic failure value of "1".
The significant values for the Windows generation platform with a Crystal Reports report are as follows:1 Unable to load Crystal Reports runtime 2 The .RPT report file was not found 3 Unable to create the data container [RDC] 4 Unable to open the .RPT report file 5 Unable to open a subreport of the report 6 Unable to create the data glossary [.NET]
Example
* Close, then open the PARAM file with a different member name
* via OVRDBF command
* Note: PARAM file is automatically opened and closed
* (' ' in generation options)
CLOSE PARAMETERS_FILE
AS400_COMMAND = 'OVRDBF FILE(PARAM) TOFILE(PARAM) MBR(INVOICES)'
EXECUTE_CMD AS400_COMMAND
OPEN PARAMETERS_FILE
CHAIN PARAMETERS_FILE
* Open and close the report layout to print the grand total only
* Note: it was not automatically opened ('Y' in generation options)
OPEN INV950
PRINT HEADER_FMT
PRINT TOTAL_FMT
CLOSE INV950
Other example:
* Open and close the report layout of Crystal Reports kind (VADELIA program), with preview before printing.
* Printing orders.
OPEN LAYOUTNAME
READ ORDERS_VIEW
DO_WHILE ORDERS_VIEW EXISTS
PRINT_VIEWS
READ ORDERS
REDO
CLOSE LAYOUTNAME *PRV