2

I have a table named

EQRECORDS

as below-

 A          R REQ                                                                                              
  A            FNAME         10A                                                                                  
  A            LNAME         10A                                                                                  
  A          K FNAME                  

and program as below-

fEQRECORDS if   e           k disk                
d uwvar2          s             10a   inz('ANKUR')
 /free                                            
  setll *loval req;                               
  reade uwvar2 req;                               
  dow not %eof(eqrecords) and not %error;         
    dsply lname;                                  
    reade uwvar2 req;                             
  enddo;                                          
  *inlr = *on;                                    
 /end-free    

When first time READE executes, if I want to see the value of Fname using Eval. Why is it shown Blank?

Data in the table is as below-

**FNAME       LNAME** 
VIKASH      SHUKLA
VIKASH      SHUKLA
ANKUR       VERMA 
ANKUR       MEHTA 
VIKASH      MISHRA
VIKASH      GUPTA 
ANKUR       GUPTA 
BHASKAR     MISHRA
CHINTU            
BHUVI       GUPTA 
Vikash Shukla
  • 55
  • 1
  • 2
  • 12
  • Is there an actual value in the field? Try running a query against the table with no ordering to see what the first result is. – Mike Wills Oct 07 '14 at 13:38
  • Yes Fname has value. – Vikash Shukla Oct 07 '14 at 13:39
  • My RPG is getting rusty. I can't remember if, when using a data structure, you need to use use the dot notation. `req.lname` – Mike Wills Oct 07 '14 at 13:46
  • I am getting an error "Identifier does not exist" while using req.lname. And want to see the value of Fname not of Lname as I am displaying Lname using Dsply opcode. – Vikash Shukla Oct 07 '14 at 13:51
  • 1
    It's a simple performance item. If a field is not used by the program, then the value is not moved from the I/O buffer into program memory. The value is not "blank"; it `does not exist` in program memory. The compiler doesn't create an area for fields that aren't used. The effect is much more evident when a record has dozens of unreferenced fields and there are a million records. – user2338816 Oct 07 '14 at 22:40

3 Answers3

1

I assume you are using 'eval' in the debugger. If you have OPTION(*NOUNREF) on an H-spec or the compile command then unreferenced fields are not available in the debugger. Put OPTION(*UNREF) in your H-spec to have them be included.

Scott Mildenberger
  • 1,456
  • 8
  • 17
0

Post the exact code that is giving you the problem. This should work:

 fEQRECORDS if   e           k disk
 d uwvar2          s             10a   inz('ANKUR')
 d message         s             50a   inz
  /free
   setll *loval req;
   reade uwvar2 req;
   dow not %eof(eqrecords) and not %error;
     message = %trimr(fname) + ' ' + lname;
     dsply message;
     reade uwvar2 req;
   enddo;
   *inlr = *on;
  /end-free
Buck Calabro
  • 7,558
  • 22
  • 25
0

I got the solution of this problem. I used debug(*input) in H-spec and got the result.

Try this link... Descreption about debug(*input)

Vikash Shukla
  • 55
  • 1
  • 2
  • 12