OPENSAVE-OPEN-BOX
The OPENSAVE-OPEN-BOX function opens an "Open" dialog box.
Syntax:
 CALL "C$OPENSAVEBOX" USING OPENSAVE-OPEN-BOX 
                            OPENSAVE-DATA
                     GIVING returnCode
Parameters:
OPENSAVE-OPEN-BOX
Constant
 
OPENSAVE-DATA
Group Item
It is a structure that contains information used to initialize the dialog box. When the OPENSAVE-OPEN-BOX function returns successfully, this structure contains information about the user's selection. This group item, defined in isopensave.def, has the following structure:
 
01  opensave-data.
    03 opnsav-filename       pic x(256).
    03 opnsav-flags          pic 9(4comp-x value 0.
    03 opnsav-default-ext    pic x(12).
    03 opnsav-title          pic x(80).
    03 opnsav-filters        pic x(512).
    03 opnsav-default-filter pic 9(4comp-x value 0.
    03 opnsav-default-dir    pic x(128).
    03 opnsav-basename       pic x(128).
 
opnsav-filename
Specifies the default filename.
If a pathname is provided, the behavior changes between the JFileChooser class and the GetOpenFileName Windows API.
With JFileChooser, the path is discarded and the basename is shown in the ‘File name’ field.
With the GetOpenFileName Windows API the dialog changes to the directory specified by the path and the basename is shown in the ‘File name’ field.
When the OPENSAVE-OPEN-BOX function returns successfully, opnsav-filename receives the drive designator, path, file name, and extension of the selected file.
 
opnsav-flags
The following constants, defined in isopensave.def, can be combined to set this field:
-opensave-show-preview-flag: the file chooser dialog shows image files preview on the right.
-opensave-pathmustexist: the user can type only valid paths and file names.
-opensave-filemustexist: the user can type only names of existing files.
-opensave-createprompt: if the user specifies a file that does not exist, this flag causes the dialog box to prompt the user for permission to create the file.
-opensave-noreadonlyreturn: the returned file must not be write-protected.
 
opnsav-default-ext
This item holds the default file name extension. The extension is the string of characters that appear after the "." in the file name. The value of OPNSAV-DEFAULT-EXT is added to the file name typed by the user, if the user does not type an extension. The default extension should not include the period ".". Set this item to spaces to avoid having a default extension.
 
opnsav-title
String to be placed in the title bar of the dialog box. If this member is spaces, the system uses the default title.
 
opnsav-filters
The value of OPNSAV-FILTERS describes the set of filters that the dialog box will use to restrict the set of files shown to the user.
 
 
Filters make it easier for a user to navigate through a large directory by limiting the files shown at once.
 
Each filter consists of a pair of descriptors. These descriptors are separated by a vertical bar character ("|").
 
Here is a sample OPNSAV-FILTERS setting that contains two filters:
 
"isCOBOL source files (*.cbl)|*.cbl|All files (*.*)|*.*"
 
opnsav-default-filter
This item is used in conjunction with OPNSAV-FILTERS. The value of OPNSAV-DEFAULT-FILTER determines which of the given filters to use as the initial filter. A value of "1" selects the first filter pair, "2" selects the second pair, and so on. A value of zero also selects the first pair. This setting is not used if no filters are defined.
 
opnsav-default-dir
The meaning of this field changes between the JFileChooser class and the GetOpenFileName Windows API.
With JFileChooser this field always specifies the initial directory.
With the GetOpenFileName Windows API the field is treated as follows:
If opnsav-default-dir has the same value as was passed the first time the application used an Open or Save As dialog box, the path most recently selected by the user is used as the initial directory.
Otherwise, if opnsav-filename contains a path, that path is the initial directory.
Otherwise, if opnsav-default-dir is not NULL, it specifies the initial directory.
If opnsav-default-dir is NULL and the current directory contains any files of the specified filter types, the initial directory is the current directory.
Otherwise, the initial directory is the personal files directory of the current user.
Otherwise, the initial directory is the Desktop folder.
 
opnsav-basename
When the routine returns, this item contains the base file name of the file chosen by the user. This differs from the value of OPNSAV-FILENAME in that all directory information is removed, leaving only the file name.
Return code:
returnCode can be any signed numeric data item and provides additional information:
1
Operation successful. File has been chosen.
-1
The user has pressed the "Cancel" button. opensaveData contents are not updated.