Skip to content

Commit

Permalink
Update TSTPYRUNR.RPGLE
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschoen authored May 1, 2024
1 parent 90e03b9 commit 7176adc
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions samples/TSTPYRUNR.RPGLE
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
// Desc: Build out QSHPYRUN command line in RPG
H DFTACTGRP(*NO) ACTGRP(*NEW)

D ArgDS Ds Qualified
D ArgCount 4b 0
D ArgVal 200a Dim(10)

D CurArg S 5i 0
D ArgParm S 8000a INZ('')
D Qt S 1a INZ('''')

C *ENTRY PLIST
C PARM ARGS 8002
C PARM CLCMD 9999
C PARM CLCMDLEN 15 5
C PARM Args 8002
C PARM CLCmd 9999
C PARM CLCmdLen 15 5

/free

// Assemble CL command line
// Move command list args to data structure
ArgDS=Args;

// Iterate and consolidate each
// argument into single parm for CL list.
CurArg=1;
Dow CurArg <= ArgDS.ArgCount;
ArgParm = %trim(ArgParm) + ' ' + qt +
%trim(ArgDS.ArgVal(CurArg)) + qt;
CurArg+=1;
EndDo;

// Assemble QSHPYRUN CL command line
// Add question mark to prompt it
CLCMD = '? QSHONI/QSHPYRUN ' +
CLCmd = '? QSHONI/QSHPYRUN ' +
'SCRIPTDIR(''/tmp/script.py'') ' +
'SCRIPTFILE(myscript.py) ' +
'ARGS(' +
')';
'ARGS(' + %trim(ArgParm) + ')';

// Calculate full command length for QCMDEXEC
clcmdlen=%len(%trim(CLCMD));

CLCmdLen=%len(%trim(CLCmd));

// Exit
*inlr=*on;
return;

/end-free

0 comments on commit 7176adc

Please sign in to comment.