This next section will be optional since when we are done, we will end up with the same setup as with the previous post.
The purpose of this is to show you what a signature error will look like when it occurs. But, in order to do that, we need to first change our binder language and then recreate our service program so that it contains only the latest signature. In other words, we need to purposely do something wrong (which we'd never do normally).
So, first lets copy the member F.MATH in source physical file QSRVSRC to a new member called F.MATHERR (so we know this binder language will cause an error). Then, let's remove the reference to the previous signature . When we're done, the source for our F.MATHERR member should look like this:
STRPGMEXP SIGNATURE('v2.0') EXPORT SYMBOL(#math_getSumInt) EXPORT SYMBOL(#math_getDiffInt) ENDPGMEXP
Now, let's update our F.MATH service program using the F.MATTERR binder language so that when done, only one signature will be available.
UPDSRVPGM SRVPGM(ILESAMPLE/F.MATH) MODULE(ILESAMPLE/F.MATH) EXPORT(*SRCFILE) SRCFILE(ILESAMPLE/QSRVSRC) SRCMBR(F.MATHERR)
Once done, if we display the details of our service program we can verify that yes, only one signature has been exported:
Now, if we leave things as they are, our program MATHTEST2 should run without issue since when it was created, it used the v2.0 signature. Go ahead and run that program to verify.
Program MATHTEST was compiled when only signature v1.0 was exported. What happens if we call that program now that our F.MATH service program doesn't export the v1.0 signature?
As we can see, our program crashes and reports a signature violation error.
How could we fix this? There really are two ways:
In our case we're choosing option 1, so lets update our F.MATH service program and put it back to the state it was previously when it had exported 2 signatures:
UPDSRVPGM SRVPGM(ILESAMPLE/F.MATH) MODULE(ILESAMPLE/F.MATH) EXPORT(*SRCFILE) SRCFILE(ILESAMPLE/QSRVSRC) SRCMBR(*SRVPGM)
Once this is done we can verify both signatures exist in the service program and that both programs MATHTEST and MATHTEST2 will run without issue.
Next, we will look at the difference between Global and Local Variables when using subprocedures.