Retrieve Current Directory (RTVCURDIR)

Where allowed to run: Compiled CL program or interpreted REXX (*BPGM *IPGM *BREXX *IREXX)
Threadsafe: No
Parameters
Examples
Error messages

The Retrieve Current Directory (RTVCURDIR) command is used in a control language (CL) program to retrieve the name of the current directory into the specified CL variable. An absolute path name containing no symbolic links is retrieved. The length of the name of the current directory is also retrieved.

The CL prompt for this command lists the minimum length for retrieved variables next to the appropriate parameters. For character variables, a single number is shown. For decimal variables, two numbers are shown. The first number indicates the minimum variable length and the second number indicates the minimum number of decimal positions.

Restrictions:

  1. Execute (*X) authority is required to the current directory and the user must have read, execute (*RX) authority to each directory in the path.

  2. This command is valid only within a CL program.

  3. The maximum length of a directory name that can be retrieved is limited by the maximum length of a character variable.

    The maximum length of a character variable cannot exceed 9999 bytes.

Top


 

Parameters

Keyword Description Choices Notes
RTNDIR CL var for RTNDIR (9999) Character value Required, Positional 1
DIRNAMLEN CL var for DIRNAMLEN (7 0) Decimal number Required, Positional 2

Top

 

CL var for RTNDIR (9999) (RTNDIR)

Specifies the name of the CL variable that receives the name of the current directory. The variable must be a character variable. If the current directory name has fewer characters than the variable allows, the value is not padded.

Top

 

CL var for DIRNAMLEN (7 0) (DIRNAMLEN)

Specifies the name of the CL variable that receives the length (in bytes) of the current directory name. This length can be longer than the length of the character variable to receive the directory name. The variable must be a 7-digit decimal variable specified with no decimal positions.

Top


 

Examples

Example 1: Retrieving the Current Directory

 RTVCURDIR   RTNDIR(&CD)  DIRNAMLEN(&CDLEN)

This command retrieves the name of the current directory and the length of the name of the current directory into the CD and CDLEN variables.

Top


 

Error messages

*ESCAPE Messages

CPFA085

Home directory not found for user &1.

CPFA09C

Not authorized to object. Object is &1.

CPFA0A1

An input or output error occurred.

CPFA0A9

Object not found. Object is &1.

Top