-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
David FOXWELL wrote:
What is the normal manner to initialize such variables between program calls? Without using activation group *NEW. Currently, it seems we are relying on a CLP that issues a RCLRSC.
Thanks.
I usually check to see if the method parameter values have changed and
reset static variables to initialization values if they have. That
allows the efficiency of returning cached values without recalculation
when there's significant processing involved in producing the output. If
necessary, I write a public clean-up method, which sets a global
"reinit" variable, then calls each method in the module with default
parameter values in order to close files, deallocate heap storage and
reinitialize everything. That works pretty well, but you have to be wary
of cached "prepared" SQL cursors. If you use them, you either need to
reset the SQL database connection (messy, but doable), RCLACTGRP or call
CEETREC. RCLRSC doesn't work with ILE code, but you can easily RCLACTGRP
if you run in a named activation group. Do yourself a favor though, and
run service programs in ACTGRP(*CALLER). Just use named activation
groups at the *PGM level. Otherwise, you'll end up with a headache
trying to debug. Activation groups (even named ones) are local within
the job.
- --
Pete Hall
pete@xxxxxxxxxxxxxx
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAktfcL4ACgkQXczQcKdXKg6EAACdFpt5lU+MonX0DL2gEfLwGOV+
ncEAoILI13RciQZ8bpZqnRoa/oJPPkVe
=m2U5
-----END PGP SIGNATURE-----
As an Amazon Associate we earn from qualifying purchases.