On this page you enter the a command that will be executed after successful installation.
The purpose of this is, that you can have an installation/setup program executed, that will do what is needed to get your software up and running.
Meaning of the field:
Field | Description |
---|---|
Command to run | In this field you must enter the command to be called when the installation was successful. The field support the following replacement value:
You can enter the replacement value in upper or lower case. |
Example of command to be executed at the end of a successful installation:
CALL %instlib%/MyInstPgm Parm(‘%instlib%’)
Please note, that if the package will only contain IFS folders and objects, a library will never be found, and in this case the command must not refer to the replacement variable %instlib%.
In case your program concludes that it cannot perform what it was coded to do, it should send a message of type *ESCAPE to the caller. This message will be displayed to the user.
Added in V1.50.
Below please find an example of a program to be called after a successful installation.
This example is an IBM i® Control Language program.
/* */
/* SRCINSCL */
/* -------- */
/* Example of a program to be called from iInstall to install */
/* source members into a software system. The source members are */
/* then compiled and finally removed from the distribution source */
/* file. */
/* */
/* The program takes two parameters. The first '&INSTLIB' is the */
/* name of the library in which the source file containing the new */
/* source members exist. The second parameter '&TARGETLIB' is the */
/* name of the library in which the source members are to be */
/* copied. Also, this is the library where the programs will be */
/* compiled. */
/* */
/* The field 'Command to run after installation' must contain the */
/* value: */
/* */
/* CALL %INSLIB%/SRCINSCL PARM('%INSTLIB%' 'INVOICESYS') */
/* */
/* This indicates that you have a library called 'INVOICESYS' that */
/* is to be the target of the installation. Of cause this must be */
/* adjusted to your installation. */
/* */
/* Further, the source file 'QCORRSRC' could be installed in a */
/* library called 'PATCH', and you should say NO to overwrite the */
/* the file and YES to create the library. */
/* */
PGM PARM(&INSTLIB &TARGETLIB)
DCL VAR(&INSTLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&TARGETLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&TARGETSRC) TYPE(*CHAR) LEN(10)
DCL VAR(&MEMBER) TYPE(*CHAR) LEN(10)
DCL VAR(&MBRTYPE) TYPE(*CHAR) LEN(10)
DCL VAR(&COMPCMD) TYPE(*CHAR) LEN(200)
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(100)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
DCL VAR(&ERRORFL) TYPE(*LGL)
/* */
/* Set-up a global error handler. */
/* */
MONMSG MSGID(CPF0000 MCH0000) EXEC(GOTO CMDLBL(ERROR))
/* */
/* Verify that the source file and the target library exist. */
/* */
CHKOBJ OBJ(&INSTLIB/QCORRSRC) OBJTYPE(*FILE) AUT(*ALL)
CHKOBJ OBJ(QSYS/&TARGETLIB) OBJTYPE(*LIB) AUT(*USE)
/* */
/* Establish a loop that will find the *FIRST member of the file. */
/* We use '*FIRST' because we will delete the member after the. */
/* */
LOOP: RTVMBRD FILE(&INSTLIB/QCORRSRC) MBR(*FIRST) +
RTNMBR(&MEMBER) SRCTYPE(&MBRTYPE)
MONMSG MSGID(CPF3019) EXEC(RETURN)
/* */
/* Set-up name of target source file. Value '*NONE' is used to check */
/* if we found a source file that correspond to the source member */
/* type. */
/* */
CHGVAR VAR(&TARGETSRC) VALUE('*NONE')
/* */
/* RPG program? */
/* */
IF COND(&MBRTYPE *EQ 'RPG') THEN(DO)
CHGVAR VAR(&TARGETSRC) VALUE('QRPGSRC')
CHGVAR VAR(&COMPCMD) VALUE('CRTRPGPGM' *BCAT +
&TARGETLIB *TCAT '/' *CAT &MEMBER *BCAT +
'SRCFILE(' *CAT &TARGETLIB *TCAT '/' *CAT +
&TARGETSRC *TCAT ')')
ENDDO
/* */
/* Display file member? */
/* */
ELSE CMD(IF COND(&MBRTYPE *EQ 'DSPF') THEN(DO))
CHGVAR VAR(&TARGETSRC) VALUE('QDDSSRC')
CHGVAR VAR(&COMPCMD) VALUE('CRTDSPF' *BCAT +
&TARGETLIB *TCAT '/' *CAT &MEMBER *BCAT +
'SRCFILE(' *CAT &TARGETLIB *TCAT '/' *CAT +
&TARGETSRC *TCAT ')')
ENDDO
/* */
/* Phycial file member? */
/* */
ELSE CMD(IF COND(&MBRTYPE *EQ 'PF') THEN(DO))
CHGVAR VAR(&TARGETSRC) VALUE('QDDSSRC')
CHGVAR VAR(&COMPCMD) VALUE('CRTPF' *BCAT +
&TARGETLIB *TCAT '/' *CAT &MEMBER *BCAT +
'SRCFILE(' *CAT &TARGETLIB *TCAT '/' *CAT +
&TARGETSRC *TCAT ')')
ENDDO
/* */
/* Logical file member? */
/* */
ELSE CMD(IF COND(&MBRTYPE *EQ 'LF') THEN(DO))
CHGVAR VAR(&TARGETSRC) VALUE('QDDSSRC')
CHGVAR VAR(&COMPCMD) VALUE('CRTLF' *BCAT +
&TARGETLIB *TCAT '/' *CAT &MEMBER *BCAT +
'SRCFILE(' *CAT &TARGETLIB *TCAT '/' *CAT +
&TARGETSRC *TCAT ')')
ENDDO
/* */
/* Control Language member? */
/* */
ELSE CMD(IF COND(&MBRTYPE *EQ 'CLP') THEN(DO))
CHGVAR VAR(&TARGETSRC) VALUE('QCLSRC')
CHGVAR VAR(&COMPCMD) VALUE('CRTCLPGM' *BCAT +
&TARGETLIB *TCAT '/' *CAT &MEMBER *BCAT +
'SRCFILE(' *CAT &TARGETLIB *TCAT '/' *CAT +
&TARGETSRC *TCAT ')')
ENDDO
/* */
/* If the member type did not correspond to one we know about, then */
/* issue an error message. Please note, that the '*ESCAPE' msg type */
/* is what makes iInstall understand that something went wrong and */
/* therefore, the message must be shown to the user. */
/* */
IF COND(&TARGETSRC *EQ '*NONE') THEN(SNDPGMMSG +
MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
MSGDTA('The member' *BCAT &MEMBER *BCAT +
'was found in the source file' *BCAT +
&INSTLIB *TCAT '/QCORRSRC, type' *BCAT +
&MBRTYPE *TCAT '. Do not know what to do +
with it. Call your supplier.') +
MSGTYPE(*ESCAPE))
/* */
/* Copy the source member to the correct library/source file. */
/* */
CPYSRCF FROMFILE(&INSTLIB/QCORRSRC) +
TOFILE(&TARGETLIB/&TARGETSRC) +
FROMMBR(&MEMBER)
/* */
/* Execute the compile command. */
/* */
CALL PGM(QSYS/QCMDEXC) PARM(&COMPCMD 200)
/* */
/* If everything went well (errors are catched by the global error */
/* handler) we can remove the source member from the correction */
/* source file. */
/* */
RMVM FILE(&INSTLIB/QCORRSRC) MBR(&MEMBER)
GOTO CMDLBL(LOOP)
/* */
/* Global error handler. */
/* */
ERROR: IF COND(&ERRORFL *EQ '1') THEN(SNDPGMMSG +
MSGID(CPF9898) MSGF(QSYS/QCPFMSG) +
MSGDTA('Internal error.') MSGTYPE(*ESCAPE))
CHGVAR VAR(&ERRORFL) VALUE('1')
RCVMSG MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) SNDMSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
ENDPGM