Step 5 Create Function iiiFN18 Test PDF Output for Employees

LANSA Integrator

Step 5. Create Function iiiFN18 – Test PDF Output for Employees

1.Create an RDML function, iiiFN18 – Test PDF Output for Employees belonging to process iiiPRO10.

2.Replace its code with the following:

FUNCTION OPTIONS(*DIRECT)

OVERRIDE FIELD(#STD_FLAG) LABEL('Report Type')

GROUP_BY NAME(#SCREEN) FIELDS((#STD_FLAG *L004 *P002) (#EMPNO *L008 *P002) (#SURNAME *L009 *P002) (#DEPTMENT *L010 *P002) (#OPT01 *L006 *P021 *OUTPUT *NOID) (#OPT02 *L004 *P021 *OUTPUT *NOID) (#OPT03 *L005 *P021 *OUTPUT *NOID))

DEFINE FIELD(#OPT01) REFFLD(#std_descs) DEFAULT('''E = Employee''')

DEFINE FIELD(#OPT02) REFFLD(#std_descs) DEFAULT('''S = Surname''')

DEFINE FIELD(#OPT03) REFFLD(#std_descs) DEFAULT('''D = Department''')

BEGIN_LOOP

REQUEST FIELDS(#SCREEN) IDENTIFY(*LABEL)

BEGINCHECK

VALUECHECK FIELD(#STD_FLAG) WITH_LIST('S' 'D' 'E') MSGTXT('Report Type must be D, E or S')

CASE OF_FIELD(#STD_FLAG)

WHEN VALUE_IS('= E')

FILECHECK FIELD(#EMPNO) USING_FILE(pslmst) MSGTXT('Employee not found')

WHEN VALUE_IS('= D')

FILECHECK FIELD(#DEPTMENT) USING_FILE(deptab) MSGTXT('Department not found')

WHEN VALUE_IS('= S')

IF COND('#SURNAME = *blanks')

SET_ERROR FOR_FIELD(#SURNAME)

MESSAGE MSGTXT('Surname may not be blank')

ENDIF

ENDCASE

ENDCHECK

EXCHANGE FIELDS(#EMPNO #DEPTMENT #SURNAME #STD_FLAG)

CALL PROCESS(*DIRECT) FUNCTION(IIIFN17) EXIT_USED(*NEXT) MENU_USED(*NEXT)

END_LOOP

 

3.Change the called function name using your initials.

4.If running functions on the IBM i server, check in and compile on the server.

5.Test function iiiFN17 by running function iiiFN18.

6.Check the PDF document produced when selecting by employee number, by surname and by department.