Pointer not set for location referenced in service PGM

5 pts.
Tags:
PGM
RPGLE
RPGLE array
I have a service PGM with 2 modules that are similar in functionality. One works and the other gives me the error in the title. Both load array data structures that are define using likeds. The problem I'm having is when I try and load the first array element. When I dump the PGM, it looks like my array data structure did not get defined. (the array in the other module is defined and memory allocated and it all works fine) here's the code of the module that doesn't work (line 55 is where the error happens)
0009.00 h nomain 0010.00 Fcustswl2 if e k disk usropn 0011.00 Fcusdata if e k disk usropn 0012.00 * 0013.00 * copy the prototype procedure definitions 0014.00 /copy prldcustnm 0015.00 * 0016.00 p loadcustnm b export 0017.00 d pi 0018.00 d company 2 0 0019.00 d lastName 20a 0020.00 d postalCode 10a 0021.00 d custArr likeds(custTemp) dim(10) 0022.00 * 0023.00 * local fields ----------------------------------------------------- 0024.00 d indx s 10i 0 inz(0) 0025.00 * ------------------------------------------------------------------ 0026.00 C Key01 klist 0027.00 c kfld company 0028.00 c kfld lastName 0029.00 c kfld postalCode 0030.00 * 0031.00 C Key01a klist 0032.00 c kfld company 0033.00 c kfld lastName 0034.00 * 0035.00 C Key02 klist 0036.00 c kfld company 0037.00 c kfld mt$e@# cust# 0038.00 * 0039.00 C if not %open(custswl2) 0040.00 C open custswl2 0041.00 C endif 0042.00 * 0043.00 C if not %open(cusdata) 0044.00 C open cusdata 0045.00 C endif 0046.00 0047.00 C eval indx = *zero 0048.00 C key01 setll custswl2 0049.00 C key01a reade custswl2 0050.00 C dow not %eof(custswl2) 0051.00 C and indx < 10 0052.00 C key02 chain cusdata 0053.00 C if %found(cusdata) 0054.00 C eval indx = indx + 1 0055.00 C eval custArr(indx).element = indx (error occur here) 0056.00 C eval custArr(indx).fullName = 0057.00 c %trim(cusnm) + ' ' + %trim(cusa1) + ' ' 0058.00 c + %trim(cusa3) 0059.00 C eval custArr(indx).cust# = custr# 0060.00 C endif 0061.00 C key01a reade custswl2 0062.00 C enddo 0063.00 * 0064.00 p loadcustnm e from the dump: (looks like it didn't allocate any memory) _QRNL_PRMCPY_CUSTARR POINTER SPP:*NULL _QRNL_PSTR_CUSTARR POINTER SPP:*NULL CUSTARR DS DIM(1) (1) CUST# PACKED(8,0) NOT ADDRESSABLE ELEMENT PACKED(5,0) NOT ADDRESSABLE FULLNAME CHAR(85) NOT ADDRESSABLE here's the prototype source 0011.00 * parm array ------------------------------------------------------ 0012.00 d custTemp ds dim(10) qualified 0013.00 d based(ctemp) 0014.00 d element 5p 0 overlay(custTemp) 0015.00 d cust# 8p 0 overlay(custTemp:*Next) 0016.00 d fullName 85a overlay(custTemp:*Next) 0017.00 * 0018.00 d loadcustnm pr extproc('LOADCUSTNM') 0019.00 d company 2 0 0020.00 d lastName 20a 0021.00 d postalCode 10a 0022.00 d custArr likeds(custTemp) dim(10) My other array data structure define just fine _QRNL_PRMCPY_ORDERARR POINTER SPP:F4689DB33906EC00 _QRNL_PSTR_ORDERARR POINTER SPP:F4689DB33906EC00 ORDERARR DS DIM(100) (1) ELEMENT PACKED(5,0) 00000. '00000F'X ORDER# PACKED(8,0) 00000000. '000000000F'X (2) ELEMENT PACKED(5,0) 00000. '00000F'X ORDER# PACKED(8,0) 00000000. '000000000F'X


Software/Hardware used:
rpgle

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    Three things make it impossible for us to guess what the problem is. First, custArr is defined as [ likeds(custTemp) ], but you dn't show us how custTemp is defined. I'd assume it's a parm value. Second, your READE key doesn't match the SETLL key. Third, there's no test to see if SETLL succeeded. Who knows how it's going? Could be many things. -- Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following