Page 2 of 2

Re: Grid Data Missing when window called from Service Progra

Posted: Mon Sep 08, 2014 6:02 pm
by Scott Klement
The problem here is that you have two variables named w1jobcode, and two variables named w1jobdesc. One copy of each that are 'global' variables that are used by the file, and another copy that are local to the EmTeamMembshp subprocedure that are used by your SQL fetch.

This is because the 'sqlrecord' data structure is declared locally to the subprocedure. So when you do the 'EXEC SQL FETCH' you are loading the copy that only exists inside the subprocedure.

However, the 'DCL-F' for your display file is global to the module, so it will be using the global copies of these fields, which you never put values into. Therefore, when you WRITE your subfile records, they will always be blank.

A very simple fix to this problem is to move the definition of the 'sqlrecord' data structure outside of your subprocedure. That way, it will be global, and when you load it, it will set the global copy of the variables.

Re: Grid Data Missing when window called from Service Progra

Posted: Tue Sep 09, 2014 7:43 am
by ppbedz
Thanks so much, Scott! I made the change and everything works fine now. I've just started coding subprocedures. I guess I have a bit more to learn :) Patti