| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| konakav Beginner
 
 
 Joined: 13 Jul 2004
 Posts: 12
 Topics: 3
 
 
 | 
			
				|  Posted: Wed Jul 14, 2004 10:32 am    Post subject: Table handling in easytrieve |   |  
				| 
 |  
				| Hi , 
 we have a prob to displaying the table data in easytrieve.Table data is displayng only when hardcoded but not using the subscript.
 
 For Ex:
 
 name(1)
 name(2)
 
 is getting displayed, but
 
 ctr = 1
 name(ws-ctr)
 ctr = ctr + 1
 -name(ws-ctr)
 isn't getting displayed , only the first occurence of table is populated in the both cases.
 
 Thanks
 Vk
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Wed Jul 14, 2004 11:02 am    Post subject: |   |  
				| 
 |  
				| Konakav, 
 Show your table definition and the subscript definiton. Also show us the logic as how you populated the table.
 
 Kolusu
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| konakav Beginner
 
 
 Joined: 13 Jul 2004
 Posts: 12
 Topics: 3
 
 
 | 
			
				|  Posted: Thu Jul 15, 2004 5:42 am    Post subject: |   |  
				| 
 |  
				| Hi Kolusu, 
 Please find the below code.
 
 
  	  | Code: |  	  | W-DATES        W  36  A        + VALUE 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'
 W-MMM                          +
 W-DATES          3  A OCCURS 12
 W-CTR             W  2   N  VALUE 0
 | 
 
  	  | Code: |  	  | JOB INPUT NULL W-CTR    =   W-CTR +1
 W-MMM(W-CTR)
 PRINT REPORT1
 STOP
 | 
 
  	  | Code: |  	  | REPORT REPORT1 SPACE 0 NOADJUST CONTROL FINAL NOPRINT
 TITLE 1 '*TABLE REPORT*'
 LINE 1 COL 001   W-CTR                +
 COL 021   W-MMM(W-CTR)
 | 
 Thanks,
 VK
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Thu Jul 15, 2004 11:15 am    Post subject: |   |  
				| 
 |  
				| Konakav, 
 You don't need a seperate variable for displaying the table contents. You can use INDEX phrase for the table and display the contents
 
 
  	  | Code: |  	  | 
 DEFINE W-DATES        W  36  A        +
 VALUE 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'
 DEFINE W-MMM   W-DATES   03  A OCCURS 12  INDEX W-CTR
 
 JOB INPUT NULL
 
 W-CTR = 1
 DO UNTIL W-CTR > 12
 PRINT REPORT1
 W-CTR = W-CTR + 1
 END-DO
 STOP
 
 REPORT REPORT1 SPACE 0 NOADJUST
 CONTROL FINAL NOPRINT
 TITLE 1 '*TABLE REPORT*'
 LINE 1 COL 001   W-CTR                +
 COL 021   W-MMM(W-CTR)
 
 | 
 
 However if you still insist of defining a seperate variable then, the following code gives you the results
 
 
  	  | Code: |  	  | DEFINE W-DATES        W  36  A        +
 VALUE 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC'
 DEFINE W-MMM   W-DATES   03  A OCCURS 12
 DEFINE W-CTR   W 02 N 0
 
 JOB INPUT NULL
 
 W-CTR = 1
 DO UNTIL W-CTR > 12
 PRINT REPORT1
 W-CTR = W-CTR + 1
 END-DO
 STOP
 
 REPORT REPORT1 SPACE 0 NOADJUST
 CONTROL FINAL NOPRINT
 TITLE 1 '*TABLE REPORT*'
 LINE 1 COL 001   W-CTR                +
 COL 021   W-MMM(W-CTR)
 
 | 
 
 Hope this helps...
 
 Cheers
 
 Kolusu
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| konakav Beginner
 
 
 Joined: 13 Jul 2004
 Posts: 12
 Topics: 3
 
 
 | 
			
				|  Posted: Fri Jul 16, 2004 5:21 am    Post subject: |   |  
				| 
 |  
				| Hi Kolusu, 
 Excellent!!! both are working fine.
 
 Thanks a lot,
 Konakav
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |