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.
Grid Data Missing when window called from Service Program
-
- Experienced User
- Posts: 2711
- Joined: Wed Aug 01, 2012 8:58 am
- First Name: Scott
- Last Name: Klement
- Company Name: Profound Logic
- City: Milwaukee
- State / Province: Wisconsin
-
- Experienced User
- Posts: 147
- Joined: Tue Jun 17, 2014 4:00 pm
- First Name: Patti
- Last Name: Bednarz
- Company Name: McGard
- State / Province: New York
- Country: United States
- Contact:
Re: Grid Data Missing when window called from Service Progra
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
Who is online
Users browsing this forum: No registered users and 3 guests