Skip to content

Commit

Permalink
Update ilePGM() and ileSRV() to fix issue 63
Browse files Browse the repository at this point in the history
Signed-off-by: Brandon Peterson <117427172+brandonp42@users.noreply.github.com>
  • Loading branch information
brandonp42 committed Nov 9, 2022
1 parent 84de343 commit 52aad98
Showing 1 changed file with 50 additions and 9 deletions.
59 changes: 50 additions & 9 deletions src/plugile.rpgle
Original file line number Diff line number Diff line change
Expand Up @@ -892,9 +892,9 @@
/free
myFile = %trim(pTmpFile)+x'00';
fd = openIFS(myFile
:O_WRONLY + O_CREAT + O_TRUNC + O_TEXTDATA + O_CCSID
:O_WRONLY + O_CREAT + O_TRUNC + O_TEXTDATA + O_CCSID
:S_IRUSR + S_IWUSR
:0); //Use O_CCSID(32) & job ccsid(0)
:0); //Use O_CCSID(32) & job ccsid(0)
if fd > -1;
rc = writeIFS(fd:pData:pSize);
rc1 = closeIFS(fd);
Expand Down Expand Up @@ -964,7 +964,7 @@
// -------------
// write rexx program (once)
if sRexxRdy = *OFF;
// create src files. Use Job CCSID
// create src files. Use Job CCSID
cmdstr = 'CRTSRCPF FILE(QTEMP/XMLREXX)'
+ ' RCDLEN(92) CCSID(*JOB) MBR(HOW)';
cmdlen = %len(%trim(cmdstr));
Expand Down Expand Up @@ -4325,6 +4325,10 @@
D pargv S * inz(*NULL)
D argc S 10I 0 inz(0)
d argv s * dim(256) based(pargv)

d pArgvCurr s *
d pArgvEnd s *

/free
Monitor;

Expand All @@ -4339,11 +4343,27 @@

// _CALLPGMV(&object_pointer, (void **)&argv[2], argc-2);
pargv = sArgvBegP;
for argc = 0 to 256;
if argv(argc+1) = *NULL;

// calculate argv memory space end address
pArgvEnd = pargv + sArgvSz - 1;

// find the last parameter given - allows *OMIT parameters in the middle
argc = %elem(argv);
dow 1 = 1;
if argc = 0;
leave;
endif;
endfor;

// make sure we only look at pointers within the
// memory space allocated and in use for them
pArgvCurr = %addr(argv(argc));
if pArgvCurr < pArgvEnd and argv(argc) <> *NULL;
leave;
endif;

argc -= 1;
enddo;

if piReturn <> *NULL;
pCopy = piReturn;
myCopy.intx = -1;
Expand Down Expand Up @@ -4401,6 +4421,10 @@
D pargv S * inz(*NULL)
D argc S 10I 0 inz(0)
d argv s * dim(256) based(pargv)

d pArgvCurr s *
d pArgvEnd s *

d div16 s 10i 0 inz(16)
D AnyDS ds qualified based(Template)
D AnyProc * Procptr
Expand Down Expand Up @@ -4981,12 +5005,29 @@
return *OFF;
endif;

// set the argv pointer
pargv = sArgvBegP;
for argc = 0 to 256;
if argv(argc+1) = *NULL;

// calculate argv memory space end address
pArgvEnd = pargv + sArgvSz - 1;

// find the last parameter given - allows *OMIT parameters in the middle
argc = %elem(argv);
dow 1 = 1;
if argc = 0;
leave;
endif;
endfor;

// make sure we only look at pointers within the
// memory space allocated and in use for them
pArgvCurr = %addr(argv(argc));
if pArgvCurr < pArgvEnd and argv(argc) <> *NULL;
leave;
endif;

argc -= 1;
enddo;

if piReturn <> *NULL;
pCopy = piReturn;
myCopy.intx = -1;
Expand Down

0 comments on commit 52aad98

Please sign in to comment.