Introduction

Use this Robot Schedule date utility program, BEGFISCMON, to calculate the date of the first day of the current fiscal month. Use the BEGFISCMON program in a Robot Schedule reserved command variable to do its calculation and pass the calculated date to the commands in a Robot Schedule job.

Steps

  1. Enter the source code as shown in Figure 1 below and compile the program into a library other than ROBOTLIB.

  2. Set up a reserved command variable as shown in Figure 2 below.

  3. Enter the reserved command variable into the commands of the Robot Schedule job as shown in Figure 3 below. Note: If the date used in the command normally has quotes around it, you must place quotes around the reserved command variable name.

  4. The result of the reserved command variable substitution is shown in Figure 4 below.

Figure 1 (below): The BEGFISCMON date utility program. Compile the program into a library other than ROBOTLIB.

*************** Beginning of data ********************************************
0001.00 /**************************************************************/
0002.00 /* BEGFISCMON - This program will calculate the 1st day of */
0003.00 /* the current fiscal month based on the current */
0004.00 /* date and a calendar name specified by the */
0005.00 /* user. */
0006.00 /* */
0007.00 /* Parameters - Input parameter is 50 characters long with */
0008.00 /* calendar name in the first 10 character. */
0009.00 /* This parameter size is required because this */
0010.00 /* program is to be used in a Robot Schedule */
0011.00 /* Reserved Command Variable which requires the */
0012.00 /* input parameter to be in 50 characters. */
0013.00 /* Output parameter is 6 characters returning */
0014.00 /* 1st day of the fiscal month */
0015.00 /* */
0016.00 /**************************************************************/
0017.00
0018.00 PGM (&VALUE)
0019.00
0020.00 /*DATE VARIABLE*/
0021.00 DCL VAR(&DATE) TYPE(*CHAR) LEN(6)
0022.00
0023.00 /*VARIABLE USED TO RETURN BEGINNING OF CURRENT FISCAL MONTH*/
0024.00 DCL VAR(&VALUE) TYPE(*CHAR) LEN(50)
0025.00
0026.00
0027.00 /*VARIABLE TO RETRIEVE PREVIOUS MONTH END DATE*/
0028.00 DCL VAR(&VAR1) TYPE(*DEC) LEN(6 0) VALUE(99)
0029.00
0030.00 /*VARIABLES USED TO RETURN FISCAL DATE*/
0031.00 DCL VAR(&VAR2) TYPE(*DEC) LEN(6 0)
0032.00 DCL VAR(&VAR3) TYPE(*DEC) LEN(6 0)
0033.00 DCL VAR(&VAR5) TYPE(*CHAR) LEN(6)
0034.00
0035.00
0036.00 /*VARIABLE IN CALCULATING 1ST DAY FROM PREVIOUS MONTH END DATE*/
0037.00 DCL VAR(&VAR4) TYPE(*DEC) LEN(6 0) VALUE(1)
0038.00
0039.00 /*VARIABLE USED TO RETURN IF ROBOTLIB EXISTS*/
0040.00 DCL VAR(&EXIST) TYPE(*CHAR) LEN(1) VALUE('N')
0041.00
0042.00 /*CALENDAR NAMEE*/
0043.00 DCL VAR(&CALNAM) TYPE(*CHAR) LEN(10)
0044.00 CHGVAR VAR(&CALNAM) VALUE(%SST(&VALUE 1 10))
0045.00
0046.00 /*RETRIEVE SYSTEM DATE*/
0047.00 RTVSYSVAL SYSVAL(QDATE) RTNVAR(&DATE)
0048.00 CHGVAR VAR(&VAR2) VALUE(&DATE)
0049.00
0050.00 /*CALL PROGRAM RBT802 FROM ROBOTLIB*/
0051.00 ADDLIBLE ROBOTLIB
0052.00 MONMSG CPF2103 EXEC(CHGVAR &EXIST 'Y')
0053.00 CALL PGM(ROBOTLIB/RBT802) PARM(&VAR2 &VAR1 'L' &CALNAM)
0054.00 CHGVAR VAR(&VAR3) VALUE(&VAR2)
0055.00
0056.00 /*CALL RBT802 AGAIN*/
0057.00 CALL PGM(ROBOTLIB/RBT802) PARM(&VAR3 &VAR4 '+' &CALNAM)
0058.00 IF (&EXIST *EQ 'N') THEN(DO)
0059.00 RMVLIBLE ROBOTLIB
0060.00 ENDDO
0061.00
0062.00 CHGVAR VAR(&VALUE) VALUE(' ')
0063.00 CHGVAR VAR(&VAR5) VALUE(&VAR3)
0064.00 CHGVAR VAR(&VALUE) VALUE(&VAR5)
0065.00
0066.00 ENDPGM
****************** End of data **********************************************

 

Figure 2 (below): Define the &&BEGMONTH reserved command variable in Robot Schedule.

 

Figure 3 (below): Enter the &&BEGMONTH reserved command variable in your Robot Schedule job.

 

Figure 4 (below): When the Robot Schedule job runs, the result of the reserved command variable substitution displays as a message.

 


Still have questions? We can help. Submit a case to Technical Support.

Last Modified On: March 08, 2018