**********************************************************************
* ___ _ _ __ __ _ _ *
* | . > ___ ___ _| |_ | |_ | \ \ ___ _ _ _| |_ <_>._ _ *
* | . \/ . \/ . \ | | | . | | |<_> || '_> | | | || ' | *
* |___/\___/\___/ |_| |_|_| |_|_|_|<___||_| |_| |_||_|_| *
* *
* A program to demonstrate interactions with a PC from RPG. *
* (Uses STRPCCMD) *
* *
* *
* 1/2008 ‚booth@martinvt.com€*
**********************************************************************
H COPYRIGHT('Booth Martin, All rights reserved.')
**--------------------------------------------------------------------*
** FILES *
**--------------------------------------------------------------------*
H option(*nodebugio)
FUTL05D cf e workstn
* Prototypes.
D pQcmdExc pr ExtPgm('QCMDEXC')
D 1024 const
D 15 5 const
**--------------------------------------------------------------------*
** DEFINITIONS *
**--------------------------------------------------------------------*
* Working fields.
D wS1Exit s 1
D wCommand s 1024
D wCmdString s 1024 varying
**====================================================================*
** MAIN CALCULATIONS *
**====================================================================*
* Display screen.
C exsr S1Main
* Exit.
C exsr ExitPgm
**====================================================================*
** MAINLINE-END *
**====================================================================*
*-------------------------------* Sub-Routine *
* *inzsr() *---------------*
* Initialize variables, set constants. *
*-----------------------------------------------*
C *inzsr begsr
C endsr
*-------------------------------* Sub-Routine *
* ExitPgm() *---------------*
* Exit program. *
*-----------------------------------------------*
C ExitPgm begsr
C eval *inlr = *on
C return
C endsr
**--------------------------------------------------------------------*
** Screen 1 procedures. Screen1 *
**--------------------------------------------------------------------*
*-------------------------------* Sub-Routine *
* S1Main() *---------------*
* Screen - Main processing. *
*-----------------------------------------------*
C S1Main begsr
* Setup.
C exsr S1Fill
* Loop until exit.
C eval wS1Exit = 'N'
C dow wS1Exit = 'N'
* Display screen.
C exsr S1ReFill
C exfmt S1
* Perform keypress.
C select
* F3=Exit.
C when *inkc = *on
C exsr ExitPgm
* Radio button selected.
C when PB1 > 0
C exsr S1KeyEnter
* everything else; go around again.
C other
C endsl
C enddo
C endsr
*-------------------------------* Sub-Routine *
* S1Fill() *---------------*
* Screen - Fill screen. *
*-----------------------------------------------*
C S1Fill begsr
C endsr
*-------------------------------* Sub-Routine *
* S1ReFill() *---------------*
* Screen - Refill screen. *
*-----------------------------------------------*
C S1ReFill begsr
C eval PB1 = 0
C endsr
*-------------------------------* Sub-Routine *
* S1KeyEnter() *---------------*
* Enter key *
*-----------------------------------------------*
C S1KeyEnter begsr
C exsr S1Validate
* If no errors then proceed.
C if *in90 = *off
C exsr S1Process
C endif
C endsr
*-------------------------------* Sub-Routine *
* S1Validate() *---------------*
* Screen - Validate entry fields. *
*-----------------------------------------------*
C S1Validate begsr
C eval *in90 = *off
C endsr
*-------------------------------* Sub-Routine *
* S1Process() *---------------*
* Process screen 1 *
*-----------------------------------------------*
C S1Process begsr
* Start PC Organizer if not started.
C eval wCmdString = 'STRPCO PCTA(*NO)'
C callp(e) pQCmdExc(wCmdString:
C %len(%trim(wCmdString)) )
* Establish the command to perform.
C select
C when PB1 = 1
C eval wCommand =
C 'start http://www.martinvt.com'
C when PB1 = 2
C eval wCommand =
C 'notepad.exe'
C when PB1 = 3
C eval wCommand =
C 'excel.exe'
C when PB1 = 4
C eval wCommand = 'start soffice -o '
C* eval wCommand = 'start soffice -pt AFP ' +
C* '"C:\Documents and Settings\?????\'
C* + 'Desktop\???????\'
C* + '????????.jpg"'
C endsl
* Run the command from the screen.
C eval wCmdString = 'strpccmd pccmd('''
C + %trim(wCommand)
C + ''') pause(*NO)'
C callp pQCmdExc(wCmdString:
C %len(%trim(wCmdString)) )
C endsr