Chapter Contents

Previous

Next
Handling Files

Specifying Filenames and Access Methods

SAS/C library I/O functions for sequential I/O are supported for CICS, except for UNIX style I/O functions. This set of SAS/C I/O functions is supported for transient data queues (both intrapartition and extrapartition) and JES spool files. Certain conventions must be observed for filenames and access methods when using transient data queues and JES spool files for SAS/C CICS applications.


General Filename Specification

The general form of a SAS/C filename is style:name, where the portion of the name before the colon defines the filename style, and the portion after the colon is the name of the file. For example, a style of td indicates the filename is a transient data queue name; the style spl indicates the filename is a JES spool file.

The style: part of the filename is optional. If no style is specified, the style is chosen by the compiler as follows:

For more information on the __style external variable, see Chapter 9, "Run-Time Argument Processing," in the SAS/C Compiler and Library User's Guide.


Access Method Parameters

When you open a file with afopen , afreopen , or aopen , you can optionally specify one or more access method parameters (amparms). These system-dependent options supply information about how the file will be processed or allocated. Amparms are character strings containing one or more specifications of the form amparm=value, separated by commas (for example, "recfm=v,reclen=100" ). Amparms can be specified in any order and in uppercase or lowercase letters.

Amparms relevant to CICS describe file processing. This is a subset of the amparms supported by the library in other environments. Whenever reasonable, inapplicable amparms are ignored rather than rejected. The function descriptions for afopen , afreopen , and aopen in the SAS/C Library Reference, Volume 1 provide examples of typical usage.

File Characteristics Amparms

The file-processing amparms for CICS may be classified into two categories: file characteristics amparms and file usage amparms. The following amparms define file characteristics:

recfm=f|v|u
operating system record format

reclen=nnn|x
operating system record length

blksize=nnn
operating system block size

These amparms are used to specify a program's expectations for record format, maximum record length, and block size. If the file is not compatible with the program's specifications, the file is still opened, but a warning message is directed to the standard error file. recfm defines the file's expected record format.

Note:    The values of recfm must be specified exactly as shown ( f , v , or u ). No other characteristics are valid.  [cautionend]

reclen defines the maximum record length the program expects to read or write. The specification reclen=x (which is not permitted with recfm specifications other than v ) indicates that there is no maximum record length. blksize specifies the maximum block size for the file, as defined by the operating system.

File Usage Amparms

The following amparms define file usage:

print=yes|no
file destined to be printed

page=nnn
maximum lines per page (with print=yes )

pad=no|null|blank
file padding permitted

These amparms allow a program to specify how a file will be used. A specification that cannot be honored may cause the open to fail, generate a warning message, or cause a failure later in execution, depending on the circumstances. print=yes or print=no is used to indicate whether the file is destined to be printed. If print=yes is specified, ANSI carriage-control characters are written to the first column of each record of the file to produce page formatting, if the file format permits this. In your C program, you can write the '\f' character to go to a new page and the '\r' character to perform overprinting. print=yes is allowed only for files accessed as text streams and whose open mode is "w" or "a" . If these conditions are satisfied, but the file characteristics do not support page formatting, a warning message is generated, and no page formatting occurs.

If print=no is specified, then the '\f' and '\r' characters in output data are treated as normal characters, even if the file characteristics will permit page formatting to take place.

page=nnn specifies the maximum number of lines that will be printed on a page. It is meaningful only for those files opened with print=yes , or for those for which print=yes is the default. It is ignored if it is specified for any other file. pad specifies how file padding is to be performed. pad=blank requests padding with blanks, pad=null requests padding with null characters, and pad=no requests no padding. If pad=no is specified, a record that requires padding is not written, and a diagnostic message is generated. pad is meaningful only for files with fixed-length records. For files accessed as text, pad characters are added as necessary to each output record, and removed from the end of each input record. For output files accessed as binary, padding only applies to the last record. For input files accessed as binary, padding is never performed.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.