STRPREPRC Source Member Header

Header Marker Tags

The object creation command or creation parameters are stored in a STRPREPRC source header. The header consists of a series of tags, similar to HTML or XML. The tags and their meanings are:

>>PRE-COMPILER<< -Start of the header.
>>END-PRE-COMPILER<<-End of the header.
>>CRTCMD<< -Base object creation command. Can be overridden with the Creation command (CMD) parameter of the STRPREPRC command.
>>IMPORTANT<< -Start of parameter section.
>>END-IMPORTANT<< -End of parameter section.
>>COMPILE<< -Start of parameter section.
>>END-COMPILE<< -End of parameter section.
>>LINK<< -Start of parameter section.
>>END-LINK<< -End of parameter section.
>>PARM<< -Parameter and value.
>>EXECUTE<< -Execution of the object creation command.
>>CMD<< -Pre- or post command, that is executed before/after the >>EXECUTE<< tag.
>>LIBL<< -Changes the user entries of the library list and saves the previous list to variable &LX.
>>CURLIB<< -Changes the current library and saves the previous value to variable &CX.

There are no differences between the three parameter sections. Each section works the same way. It is up to you to use the section(s) that you like most. Some people may decide to use the >>COMPILE<< section for compile commands and the >>LINK<< for commands such as CRTPGM or CRTSRVPGM. Other developers may prefer to use the >>IMPORTANT<< section for all their commands in order to indicate that these parameters are important for a certain object.

Replacement Variables

The parameters specified at the command prompt are available as replacement variables and can be added to the STRPREPRC header. The following variables are available:

&SF-Source file name
&SL-Source file library name
&SM-Source member name
&OB-Object name
&LI-Object library name
&TR-Target release

Parameters/variables, related to Software Change Management systems:

&TY-Type code
&TL-Name of the test library
&TO-Name of the test object
&FF-From source file name
&FL-From source file library name
&FM-From source member name

General purpose parameters/variables:

&U0-User defined value #0
&U1-User defined value #1
&U2-User defined value #2
&U3-User defined value #3
&U4-User defined value #4
&U5-User defined value #5
&U6-User defined value #6
&U7-User defined value #7
&U8-User defined value #8
&U9-User defined value #9

Library list parameters/variables:

&LL-Library list
&CL-Current library
&LX-Previous library list
&CX-Previous current library

The STRPREPRC utility does not distinguish between the variables. All variables are handled the same as string values.

Example Header 1

This header is an example of a general purpose STRPREPRC header.
      //* >>PRE-COMPILER<<                                                        (1)
      //*   >>CRTCMD<<  CRTRPGMOD MODULE(&LI/&OB) SRCFILE(&SL/&SF) +              (2)
      //*                 SRCMBR(&SM);
      //*   >>IMPORTANT<<                                                         (3)
      //*     >>PARM<<  TRUNCNBR(*NO);                                            (4.1)
      //*     >>PARM<<  DBGVIEW(*LIST);                                           (4.2)
      //*     >>PARM<<  OPTION(*EVENTF);                                          (4.3)
      //*   >>END-IMPORTANT<<                                                     (5)
      //*   >>CMD<<     CRTDUPOBJ OBJ(QRPGLESRC) FROMLIB(QGPL) +                  (6)
      //*                 OBJTYPE(*FILE) TOLIB(QTEMP);
      //*   >>EXECUTE<<                                                           (7)
      //*   >>CMD<<     DLTF FILE(QTEMP/QRPGLESRC);                               (8)
      //* >>END-PRE-COMPILER<<                                                    (9)

Comments:

(1)Start of the STRPREPRC header.
(2)Base object creation command. Can be overridden with the Creation command (CMD) parameter of the STRPREPRC command.
(3)Start of the parameter section.
(4.1)First overridden parameter.
(4.2)Second overridden parameter.
(4.3)Third overridden parameter.
(5)End of the parameter section.
(6)Pre-command that is execute before the CRTRPGMOD command.
(7)Execution of the CRTRPGMOD command.
(8)Post-command that is execute after the CRTRPGMOD command.
(9)End of the STRPREPRC header.

Example Header 2

This header demonstrates how to use STRPREPRC together with XCRTSQLOBJ of the CMOne change management system. In order to make this example work, the administrator must specify the CMOne application library list (typically CMOENG, CMOOBJ and CMODTA) at parameter Library list (LIBL) of the STRPREPRC command.
      --  >>PRE-COMPILER<<                                                        (1)
      --    >>CURLIB<<  &CL;                                                      (2)
      --    >>LIBL<<    &LL;                                                      (3)
      --    >>CRTCMD<<  XCRTSQLOBJ SQLOBJ(&LI/&OB) SRCFILE(&SL/&SF) SRCMBR(&SM) + (4)
      --                TYPE(*TABLE) RUNSQLSTM1('NAMING(*SYS)');
      --    >>IMPORTANT<<                                                         (5)
      --      >>PARM<<  LIBL(&LX);                                                (5.1)
      --    >>END-IMPORTANT<<                                                     (6)
      --    >>EXECUTE<<                                                           (7)
      --  >>END-PRE-COMPILER<<                                                    (8)

Notice: The header above is more advanced and specifies the object creation command for documentation purposes. Typically the creation command is passed from the Change Management System (CMS) to STRPREPRC.
The >>CRTCMD<< tag and the >>IMPORTANT<< section are optional.

See also: Create SQL Table with CMOne for a minimal STRPREPRC header.

The affected CMOne Type Codes must be defined like that:

Type Code: TABLE
Command  STRPREPRC  Object creation command of the type code.
Parm: USESRCFILE &SL/&SF  Qualified name of the source file where the source member is stored that is processed by STRPREPRC.
Parm: USESRCMBR  &ES  Name of the source member, that is processed by STRPREPRC.
Parm: CMD  &CL/XCRTSQLOBJ ... TYPE(*TABLE) LIBL(VAR_LX) CMOne command for creating SQL objects.
Ensure to specify the LIBL() parameter as demonstrated here.
Parm: LIB  &OL  Name of the library where the object is created.
Parm: OBJ  &EO  Name of the object that is created.
Parm: SRCLIB  &SL  Name of the library that contains the source file where the source member is stored that is used for compiling the object.
Parm: SRCFILE  &SF  Name of the source file where the source member is stored that is used for compiling the object.
Parm: SRCMBR  &ES  Name of the source member that is used for compiling the object.
Parm: USRDEFVAR  (VAR_LX '&LX')  Map variable user-defined variable VAR_LX to STRPREPRC variable &LX.
Parm: LIBL  *CRTDFT (&LL)  CMOne parameter LIBL must be set to CMOne replacement variable &LL.
Parm: USELIBL  *YES  CMOne command for creating SQL objects.
Ensure to specify the LIBL() parameter as demonstrated here.

Notice: The CMOne replacement variable &CL and &LL are available with CMOne 5.1.9.

Comments:

(1)Start of the STRPREPRC header.
(2)Sets the current library to the value specified at parameter Library list (LIBL) of the STRPREPRC command.
(3)Sets the library list to the value specified at parameter Library list (LIBL) of the STRPREPRC command.
(4)Base object creation command. Can be overridden with the Creation command (CMD) parameter of the STRPREPRC command.
(5)Start of the parameter section.
(5.1)First overridden parameter. Forwards library list that was active before it has been changed at the >>LIBL<< tag to the XCRTSQLOBJ command.
(6)End of the parameter section.
(7)Execution of the CRTRPGMOD command.
(8)End of the STRPREPRC header.

Assign Values Automatically

Feel free to change the command defaults of the STRPREPRC command from '*NONE' to '*DFT' to automatically assign the required source file and source member parameters to their related replacement variables.

You can easily change the command default values with the CHGDFTCMD likes this:

CHGCMDDFT CMD(ISPHEREDVP/STRPREPRC) NEWDFT('OBJ(*DFT)')
CHGCMDDFT CMD(ISPHEREDVP/STRPREPRC) NEWDFT('SRCLIB(*DFT)')
CHGCMDDFT CMD(ISPHEREDVP/STRPREPRC) NEWDFT('SRCFILE(*DFT)')
CHGCMDDFT CMD(ISPHEREDVP/STRPREPRC) NEWDFT('SRCMBR(*DFT)')

This way the parameter values of USESRCFILE and USESRCMBR are automatically assigned to replacement variables &OB, &SL, &SF and &SM.