• Subject: Variable corruption
  • From: "Goodbar, Loyd (AFS-Water Valley)" <LGoodbar@xxxxxxxxxxxxxx>
  • Date: Fri, 1 Oct 1999 11:03:22 -0400

Has anyone experienced variable corruption while using APIs in an RPG/IV
program (non-ILE)?

I wrote a progam to process save files (retrieve info and display).
Everything worked fine until I started using the QWCCVTDT (Convert date and
time format) API.

Here's a quick sample:
- - - - -

d nextpos 9b 0 inz
c eval nextpos = offstart + 1
c do numentries
 * Receive entry
c call 'QUSRTVUS'
c parms .........
 * Process if save file
c if extatr = 'SAVF'
 * Convert creation date
c call 'QWCCVTDT'
c parms........
 * Display
.....
c endif
c eval nextpos = nextpos + sizeent
c enddo

- - - - -

Before using the QWCCVTDT API, nextpos would increment by 172 (the length of
the OBJL0300 return list). After inserting the API, nextpos would become
corrupted after the QWCCVTDT API was called.

For example, nextpos would increment from 1196 to 1368 (not real numbers).
After calling the QWCCVTDT, nextpos was -252513633.

Using this code fixed the problem:

- - - - -

d mynextpos 9b 0 inz               (NEW)
d nextpos 9b 0 inz
c eval nextpos = offstart + 1
c do numentries
 * Receive entry
c call 'QUSRTVUS'
c parms .........
c eval mynextpos = nextpos         (NEW)
 * Process if save file
c if extatr = 'SAVF'
 * Convert creation date
c call 'QWCCVTDT'
c parms........
 * Display
.....
c endif
c eval nextpos = mynextpos       (NEW)
c eval nextpos = nextpos + sizeent
c enddo

- - - - -

nextpos is used with the QUSRTVUS API, but not with the QWCCVTDT API. 
Has anyone had experience with the variable corruption I'm experiencing? It
was easy to work around, but this does concern me.

Thanks!

--
Loyd Goodbar
Programmer/Analyst
Borg-Warner Automotive, AFS, Water Valley

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].