LOGPARM= System Option: z/OS

Controls when SAS log files are opened, closed, and, in conjunction with the LOG= system option, how they are named.
Valid in: Configuration file, SAS invocation
Category: Log and procedure output control: SAS log
PROC OPTIONS GROUP= LOGCONTROL
z/OS specifics: Restrictions on the OPEN argument and the length of log filename
See: LOGPARM= System Option in SAS System Options: Reference

Syntax

LOGPARM=
<OPEN= APPEND | REPLACE | REPLACEOLD>
<ROLLOVER= AUTO | NONE | SESSION | n | nK | nM | nG>
<WRITE= BUFFERED | IMMEDIATE>

Optional Arguments

OPEN=
when a log file already exists, controls how the contents of the existing file are treated.
APPEND
appends the log when opening an existing file. If the file does not already exist, a new file is created. This option cannot be used if the LOG= system option specifies a member of a PDS or PDSE.
REPLACE
overwrites the current contents when opening an existing file. If the file does not already exist, a new file is created.
REPLACEOLD
appends the log when opening an existing file. If the file does not already exist, a new file is created. This option can be used if the LOG= system option specifies a UFS file, but it cannot be used if a member of a PDS or PDSE is specified.
Default:REPLACE
ROLLOVER=AUTO|NONE|SESSION|n|nK|nM|nG
controls when or if the SAS log rolls over (that is, when the current log is closed and a new one is opened). If you use ROLLOVER=n to roll over your files, the OPEN= parameter is ignored, and the initial log file is opened with OPEN=APPEND.
AUTO
causes an automatic rollover of the log when the directives in the value of the LOG= option change (that is the current log is closed and a new log file is opened).
Interaction:The name of the new log file is determined by the value of the LOG= system option. If LOG= does not contain a directive, however, the name would never change, so the log would never roll over, even when the ROLLOVER=AUTO value is used.
NONE
specifies that rollover does not occur, even when a change occurs in the name that is specified with the LOG= option.
Interaction:If the LOG= value contains any directives, they do not resolve. For example, if Log="#b.log" is specified, the directive “#” does not resolve, and the name of the log file remains "#b.log".
SESSION
at the beginning of each SAS session, opens the log file, resolves directives that are specified in the LOG= system option, and uses its resolved value to name the new log file. During the course of the session, no rollover is performed.
n|nK|nM|nG
causes the log to roll over when the log reaches a specific size, stated in multiples of 1 (bytes); 1,024 (kilobytes); 1,048,576 (megabytes); or 1,073,741,824 (gigabytes). When the log reaches the specified size, it is closed and renamed by appending “old” to the log filename, and if it exists, the lock file for a server log. For example, a filename of 2008Dec01.log is renamed 2008Dec01old.log. A new log file is opened using the name specified in the LOG= option.
Restriction:The minimum log file size is 10K.
See:Rolling Over the SAS Log in SAS Language Reference: Concepts
CAUTION:
Old log files can be overwritten.
SAS maintains only one old log file with the same name as the open log file. If rollover occurs more than once, the old log file is overwritten.
Default:NONE
Restriction:Rollover does not occur more often than once a minute.
Interaction:Rollover is triggered by a change in the value of the LOG= option.
WRITE=
specifies when content is written to the SAS log.
BUFFERED
writes content to the SAS log only when a buffer is full in order to increase efficiency.
IMMEDIATE
writes to the SAS log each time that statements are submitted that produce content for the SAS log.
Default:BUFFERED

Details

The LOGPARM= system option controls the opening and closing of SAS log files. This option also controls the naming of new log files in conjunction with the LOG= system option and the use of directives in the value of LOG=. The LOGPARM= option is effective only when the LOG= option specifies a physical data set name or UFS filename. LOGPARM= has no effect if LOG= specifies a ddname.
Native z/OS filenames that contain more than eight characters are truncated to eight characters. The character count begins with the first character of the filename. If a period is encountered, the character count begins again. For example,
testFeb1234.Wednesday
is truncated to the following
testFeb1.Wednesda
Note that testFeb1234 is truncated to testFeb1, and that Wednesday is truncated to Wednesda.
If a directive is specified in a PDS member name, the directive is fully expanded. The PDS member name might then exceed eight-characters, which is the maximum length for a PDS member name, and an error occurs.
Directives are fully expanded for the UNIX file system.
Using directives in the value of the LOG= system option enables you to control when logs are open and closed and how they are named, based on real-time events, such as time, month, day of week, and so on. The following table contains a list of directives that are valid in LOG= values:
The z/OS directives begin with #. Specifying a % directive instead of a # directive is not supported on z/OS.
Directives for Controlling the Name of SAS Log Files
Directive
Description
Range
#a
Locale's abbreviated day of week
Sun–Sat
#A
Locale's full day of week
Sunday–Saturday
#b
Local's abbreviated month
Jan–Dec
#B
Locale's full month
January–December
#C
Century number
00–99
#d
Day of the month
01–31
#H
Hour
00–23
#j
Julian day
001–366
#l *
User ID
Identifies a user to the system. The user ID consists of 1 through 8 alphanumeric or national ($, #, @) characters. The first character must be an alphabetic character or a national character ($, #, @).
#M
Minutes
00–59
#m
Month number
01–12
#n
Current system node name (without domain name)
none
#p *
Process ID
Returns your user ID in TSO, the name on the JOB card in the JCL, or the start command or proc name for a started task (STC).
#s
Seconds
00–59
#u
Day of week
1= Monday–7=Sunday
#v *
Unique identifier
alphanumeric expression that creates a log filename that does not currently exist
#w
Day of week
0=Sunday–6=Saturday
#W
Week number (Monday as first day; all days in new year preceding first Monday are in week 00)
00–53
#y
Year without century
00–99
#Y
Full year
1970–9999
##
Pound escape writes a single pound sign in the log filename.
#
* Because %v, %l, and %p are not a time-based format, the log filename never changes after it has been generated. Therefore, the log never rolls over. In these situations,specifying ROLLOVER=AUTO is equivalent to specifying ROLLOVER=SESSION.

Example: Specifying the LOGPARM Option

  • Rolling over the log at a certain time and using directives to name the log according to the time: If this command is submitted at 9:43 AM, this example creates a log file called test0943.log, and the log rolls over each time the log filename changes. In this example, at 9:44 AM, the test0943.log file is closed, and the test0944.log file is opened.
    sasrx -log "test#H#M.log" -logparm "rollover=auto"
  • Preventing log rollover but using directives to name the log: For a SAS session that begins at 9:34 AM, this example creates a log file that is named test0934.log, and prevents the log file from rolling over:
    sasrx -log "test#H#M.log" -logparm "rollover=session"
  • Preventing log rollover and preventing the resolution of directives: This example creates a log file that is named test#H#M.log, ignores the directives, and prevents the log file from rolling over during the session:
    sasrx -log "test#H#M.log" -logparm "rollover=none"
  • Creating log files with unique identifiers: This example uses a unique identifier to create a log file with a unique name:
    sasrx -log "test#v.log" -logparm "rollover=session "
    SAS creates a log file called test1.log, if test1.log does not already exist. If test1.log does exist, SAS continues to create filenames in this format - test2.log, and so on, - until it generates a log filename that does not exist.
    Because #v is not a time-based format, the log filename never changes after it has been generated. Therefore, the log never rolls over. In this situation, specifying ROLLOVER=SESSION is equivalent to specifying ROLLOVER=AUTO.