Tag Archives: RPG

RPGLE screen driven python on IBMi

By creating simple display files and corresponding RPGLE programs to display we can call Python programs to provide users with features that are either very complex or impossible to implement with pure RPGLE.

At the moment I have been calling a CL program from the RPGLE program. I plan to update this to use the QCMDEXC API and negate the need for a CL program.

We check the users input then call the CL program which in turn calls the python script

In this excerpt we use the users logon name to lookup an email address in our users table

DDsUSer 254 263
 DDUMPED S 1
 *
 DRDATE S LIKE(SYNUMB)
 DLsOkay S N
 DMSGNO S 10
 DMSGF S 10
 DMSGDTA S 256
 DFILDS3 DS 528
 DFILDS4 DS 684
 DFILDS5 DS 528
 DPDATE S 5A
 DSECURE S 3
 DSUSER S 10A
 DEMNAME S 35A
 DEMEMAIL S 100A
 **********************************************************************************************
 *
 C EVAL *IN90 = *ON
 C DOW *IN03 = *OFF
 C WRITE MSGCTL
 C EXFMT SCREEN
 C* MoveA '00000' *In(30)
 C* MOVEA '00' *IN(42)
 C* MOVEA '000' *IN(42)
 C* MOVEA '0000' *IN(42)
 C* Eval *In46 = *Off
 C* EVAL #VALID = 'YES'
 C EXSR CLEAR
 C IF *IN03 = *OFF
 C
 *
 C IF *IN30 = *OFF
 * Get users email address
 C/EXEC SQL
 C+ Select EMEMAIL, EMNAME into :EMEMAIL, :EMNAME from USERTABLE
 C+ Where EMUSER = :DsUSer
 C+ Fetch first row only
 C/End-exec
 C*
 C If SQLSTT = '00000'
 C* ENDIF
 C* MOVE DsUser SUSER
 C Call 'PROGEXCL'
 C Parm PDATE
 C Parm DsUSer
 C Parm EMEMAIL
 C*
 C Eval MSGNO = 'TRI0069'
 C Exsr WRTMSG
 C Clear SCREEN
 C* EVAL *IN30 = *ON
 C ENDIF
 C ENDIF
 C ENDIF
 C ENDDO
 C ENDIF
 C EVAL *INLR = *ON