Directory Support

WHEN READING

Multiple input files can be processed at once by using wildcard patterns as input filename and recursion into directories. It is also possible to select only certain members of FLAMFILEs by pattern or index and to specify how directories are traversed.

Input file or member names can contain the wildcards below. The wildcards are supported on subprogram level, i.e. wildcards are available in the batch utility and in subprogram calls. Wildcards are not supported on record or byte interface level.

 '*' - zero or more characters
 '+' - one or more characters
 '?' - exactly one character
 '%' - exactly one character (backward compatible with FLAM4 and conform with ISPF (not in URLs))
 '#' - exactly one digit (not supported on MVS, because '#' could be part of a qualifier)
 '=' - exactly one digit (supported on all platforms but mainly for MVS)
 '^' - escape character (put it before a wildcard character if it is part of the file/member name)

If one of the wildcard characters is part of the filename itself, you can escape the wildcard character with the caret (^). For MVS datasets each qualifier is separated with a period (.). If you want to let the asterisk (*) or plus sign (+) match more than one qualifier, you must put it twice (i.e. ** or ++). On non dataset based systems (UNIX, Windows, USS, Linux) this mechanism is not available as there are no qualifiers in filenames and hence periods are handled like any other character. Below you can find some examples:

 file='*.txt'             - all files with extension .txt including the file named .txt
 file='+.txt'             - all files with extension .txt and at least one other character
 file='?.txt'             - all files with one character and the extension .txt
 file='dat^*.txt'         - the file "dat*.txt"
 file='**.G====V=='       - all datasets ending with GnnnnVnn (all GDG datasets)
 file='<SYSUID>.**(my*)'  - all members starting with "MY" of all PO datasets under current user
 file='<SYSUID>.**(-1)'   - all previous generation of all GDG datasets under current user

The directory support for MVS includes Generation Data Groups (GDG). If you want to read only the previous generation of all GDG's under your SYSUID, you must type as follows:

 file='~.**(-1)' - all GDG's with generation -1 under my SYSUID

Is a wildcard used at read and the different files should be written into a generation data group as several versions. The file index in minimal amount of digest '[ind0]' could be used the define the next generations '(+[ind0])'.

 infile='/path/to/*.txt' pattern='<SYSUID>.GDG(+[ind0])' outfile='USER.GDG(+n)'

The enclosing quotation marks are required because the file name string contains round brackets. Strings without quotation marks are terminated at the first space character or curved or squared bracket.

If you use a wildcard in the first/high level qualifier, the catalog search interface (CSI) is used to return each dataset in the catalog. All these datasets are then compared against the corresponding pattern. This can consume a lot of time. Be careful with wildcards in the first/high level qualifier at ZOS dataset names.

Using wildcards at the beginning of a pattern (for example '**(MEMBER)') could result in opening a dataset which is stored on a tape which is not available immediately. This could result in the process waiting for console input. By default, datasets on tapes are not included in the dataset list retrieved by the wildcard mechanism. If you want to include datasets on tapes, then you must enable the corresponding switch. However, this will not prevent a console request. Files in catalog where the volume is not available, will result in the same behavior. Be careful with wildcards at the beginning of the search pattern.

The escape character can be used for datasets, but this is not required. If the match string contains parenthesis (), only PO datasets are matched. To match GDG, the first character inside the parenthesis must be +, - or a number. In all other cases, a PO dataset is assumed. Relative generation numbers are currently not supported for PO datasets.

To process only certain members inside archives, a match string for members can be used. A member can be defined as part of the URL with ? as separator. Alternatively, for FLAMFILEs, a dedicated member specification can be used. In this case a leading question mark (?) is ignored. For a question mark as first wildcard, specify two of them.

 file='test*.adc/?*FLAM*'    - All members that have "FLAM" in their name in files starting with "test" and ending with ".adc"
 file='*.adc member=*FLAM'   - All members that have "FLAM" at the end of their name in all files ending with ".adc"
 file='*.adc member=?FLAM*'  - All members whose names start with "FLAM" in all files ending with ".adc"
 file='*.adc member=??FLAM*' - All members whose names start with any character followed by "FLAM" in all files ending with ".adc"

You can also select members from archives based on the member index. In this case, the member name must start with a hash (#) or colon (:) and can contain a list of indexes and/or index ranges (two indices separated by minus (-), inclusive) separated by comma. For example:

 read.flam(file=*.adc/#3,5,8-10,15)
 read.flam(file=*.adc/:3,5,8-10,15)
 read.flam(file=*.adc member=:3,5,8-10,15)
 read.flam(file=*.adc member=#3,5,8-10,15)

All four variants read the 3rd, 5th, 8th, 9th, 10th and 15th member from files in the current directory that end with ".adc".

To define how wildcard strings are matched, there is an object called 'DIR' that contains some switches. These include recursion into sub-directories, recursion into archives, inclusion of hidden files, symbolic link, etc. See the chapter to the 'DIR' object below for more information.

WHEN WRITING

Missing directories are created automatically. To prevent this the switch 'NOMKDAR' must be activated. Overwriting of existing files can be prevented with the 'REMAIN' switch (see below).

To convert the file names matched to a certain file name for writing see INPUT TO OUTPUT NAME MAPPING.