Syntax
SETTITLE extract_file expression [ PACK expression ] [ EXIST ]
Parameters
extract_file
The extract file to name.
expression
The name to assign to the extract file. For Windows-based systems this can be any valid path up to 100 characters in length, the file name portion of which can be up to 14 characters in length.
For applications that run on Windows, if this is an absolute path, it overrides the path specified for the extract pack. To use the specified extract pack, this path should be relative to the extract pack path.
Note: Filenames defined within string literals must have backslash characters escaped by a backslash. For example, “C:\\Folder\\File.dat”. Refer to String Literals for more information.
For MCP-based runtime hosts, this path name might contain any number of levels, but cannot exceed 18 characters (including slash characters). System usercodes must not be included. If a pack name is specified (in the Pack part of this command), the filename length can be up to 39 characters less the length of the name of the Extract pack or the length of the expression following the Pack statement.
If the Extract file is to go to TAPE, the value of this parameter depends on the host type, as shown in the following table.
Host Type | Parameter Value |
---|---|
Windows | Pathname to the tape drive |
MCP environment | Tape name |
Packexpression
The Pack command option is not supported on applications deployed to Windows.
Note: This command option is valid only for MCP-based systems.
This command option gives the disk pack name if the Extract file is to go to disk (that is, DISK was selected on the Extract File Options screen).
Exist
Treats the extract file as an Existing extract file. Refer to Extract File Categories and SetTitle Extract File Processing for more information on the behavior of different extract file categories.
Description
The SetTitle logic command changes the name of a report extract file during the running of the report.
The SetTitle logic command explicitly closes the specified extract file, and specifies a file name to be used by subsequent Determine Actual, Extract, ForEach, or Sort logic statements.
If the previous extract file has not been retained, it is deleted by the SetTitle logic command.
For an MCP-based system, since SetTitle is a runtime command, it overwrites any TITLE system attribute set (for example, for a Report initiated from RIP).
Restrictions
An extract file that is not accessed during the running of the report, but is named using the RetainAs command option of an Extract logic statement or a SetTitle logic statement (without the Exist command option), is deleted upon report termination. If the file is named using a SetTitle logic statement (with the Exist command option), it is not deleted.
If both the RetainAs command option of the Extract logic statement and the SetTitle logic command specifies the same extract file in a report, the extract is purged when the SetTitle logic statement is executed. The RetainAs command option of the Extract logic statement and the SetTitle logic statement should not both specify the same extract file in a report.
Examples
Example 1
This example creates a physical file that is assigned the name entered by the user. The file is then loaded by extracting SRep records to it. Assuming this is all the logic in the report, at the end of the report the file is kept, and it will contain the details extracted from SRep.
Message Attention "Enter the name for the SalesRep file" Accept SD_A SetTitle FileA SD_A : Creates an empty file with the entered name LookUp Every SRep Extract SRep As FileA : The file is loaded by the Extract End
Example 2
This example opens the existing physical file that it is identified by the name entered by the user. The file is then sorted by name order. Assuming this is all the logic in the report, at the end of the report the file is kept, with records sorted in ascending order of SalesRep name. In the code, a dummy Determine logic statement is used to associate the file layout B with the SRep ispec. In most situations, this Determine logic statement loop could be used to perform a desired function; for example, to print the sorted file.
Message Attention "Enter the name for the SalesRep file" Accept SD_B SetTitle FileB SD_B Exist : Names the existing file. FileB.Sort(Key(FileB.SRep.Name, “Ascending”)) : The file is sorted. SD_True := "True" If SD_True = "False" Determine Actual FileB ExtractedAs Srep : Determine or Extract needed Break : to associate file layout End : FileB with the SRep ispec. End