Using IFS Source Files - IBM - RPG

The CRTBNDRPG and CRTRPGMOD commands include parameters to allow the source files to be either in the QSYS file system of in the IFS sile system. These are:

SRCSTMF
SRCSTMF is used instead of SRCFILE and SRCMBR to indicate a stream file is the main source file.

INCDIR
INCDIR is used to list the directories that will contain copy files.The stream file specified for the SRCSTMF can be an absolute path to the file (beginning with a slash), or it can be a path relative to the current directory.

Include files

The /COPY and /INCLUDE directives allow the specification of files in either the QSYS file system or the IFS file system. In cases where the compiler cannot tell which file system the directive refers to, the search will begin in the file system of the file containing the /COPY directive.

When the compiler encounters a /COPY statement, the statement could refer to a file in the IFS or in the QSYS file system. If the name begins with a slash or is specified in single quotes, the name can only refer to a file in the IFS. A name in the IFS can be specified in double quotes as well. Where only part of the name is in double quotes, for example:

/copy "SOME-LIB"/QRPGLESRC,MBR

the name can only be a QSYS file system name.

If the name could be either in the QSYS file system or the IFS, the file system of the file containing the /COPY statement will be searched first. Note that upper-casing occurs for the QSYS file system (except with extended names specified with double quotes, such as ″A/B″) but not for the IFS. (The IFS is not case sensitive.)

Copy File Name Intepretation for QSYS and IFS
Copy File Name Intepretation for QSYS and IFSCopy File Name Intepretation for QSYS and IFS

Note: When searching for files in the IFS, if the file name does not contain a dot, the RPG compiler will look for files with the following suffixes (in this order):

  1. no suffix (abc)
  2. rpgleinc (abc.rpgleinc)
  3. rpgle (abc.rpgle)

Search Path Within The IFS

You have two ways to indicate where /COPY and /INCLUDE files can be found in the IFS:

  1. The INCDIR parameter, which lists the directories in the order you want them to be searched.
  2. The RPGINCDIR environment variable, which has a colon-separated list of directores in the order you want them to be searched. To set the environment variable, use the ADDENVVAR or CHGENVVAR command.
  3. For Example: ADDENVVAR ENVVAR(RPGINCDIR)VALUE (’ /home /mydir: /project /prototypes’) ADDENVVAR

When searching for a relative file in the IFS (one whose path does not begin with /), the file will be searched for in the following places, in this order

  1. The current directory.
  2. The path specified by the INCDIR comand parameter.
  3. The directories in the RPGINCDIR environment variable.
  4. The source directory (if the source is an IFS file).

For example, if:

  • The current directory is /home/auser.
  • The INCDIR parameter is /driver/v5r2/inc:/driver/v5r1/inc.
  • The RPGINCDIR environment variable is /home/auser/temp.
  • The source is in directory /home/auser/src.

The directory search path takes precedence over the default-suffix order. If a file with no extension is searched for in several different directories, all suffixes will be tried in each directory before the next directory is tried.

Search Order for Copy Files

Search Order for Copy Files


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

IBM - RPG Topics