Re: Grid Data Missing when window called from Service Progra
Posted: Mon Sep 08, 2014 6:02 pm
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.
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.