| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Disco_Stu Beginner
 
 
 Joined: 04 Feb 2003
 Posts: 19
 Topics: 7
 
 
 | 
			
				|  Posted: Tue Feb 04, 2003 2:07 pm    Post subject: entry points |   |  
				| 
 |  
				| I am currently reworking a program which uses entry points. I'm not too knowledgable in the area. 
 I have a called program. The first entry point(M7476620) opens the output file. Calls to the next entry point (M7476631) write to the previously opened file.
 
 I enter at the first point, and everything is ok. Later, my call enters at the second point and I get a SOC4. I am thinking that at this point the output file has been closed? Something to do with the GOBACK?
 
 Here is the code:
 
  	  | Code: |  	  | 0-OPEN.
 ENTRY 'M7476620'.
 SKIP1
 DISPLAY '*** VALID WRITE MODUEL - M7476620 - CALLED - '
 'LAST UPDATED DEC 16, 1976 - SMF *** '.
 OPEN OUTPUT VALFILE.
 GOBACK.
 SKIP3
 
 1-MAINSTREAM.
 ENTRY 'M7476631'    USING VALID-EXTRACT-RECORD.
 DISPLAY 'M7476631 CALLED'.
 SKIP1
 1-WRITE-VALID-REC.
 WRITE VALID-RECORD   FROM VALID-EXTRACT-RECORD.
 GOBACK.
 SKIP3
 
 | 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Disco_Stu Beginner
 
 
 Joined: 04 Feb 2003
 Posts: 19
 Topics: 7
 
 
 | 
			
				|  Posted: Tue Feb 04, 2003 2:20 pm    Post subject: |   |  
				| 
 |  
				| also, not sure if it matters, but i'm making the calls to the entry points dynamically. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Tue Feb 04, 2003 2:35 pm    Post subject: |   |  
				| 
 |  
				| Disco_stu, 
 Static calls to alternate entry points work without restriction.Dynamic calls to alternate entry points require:
 
 
 NAME or ALIAS linkage editor control statements.
The NAME compiler option. 
An intervening CANCEL for dynamic calls to the same program at differing entry points.
 Be aware that the CANCEL will cause the program to be invoked in initial state when it is called at a new entry point.
 
 Hope this helps...
 
 cheers
 
 kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Disco_Stu Beginner
 
 
 Joined: 04 Feb 2003
 Posts: 19
 Topics: 7
 
 
 | 
			
				|  Posted: Tue Feb 04, 2003 4:04 pm    Post subject: |   |  
				| 
 |  
				| Ok, so the CANCEL is necessary.  But this will close my output file in my called program, right?  So the second time i go into the called program and try to write, the output file is closed.  Hence, S0C4. 
 I took out the CANCEL statment (just for fun) and it seems like the same thing is happening. Without the CANCEL statement I would assume the called program would stay in its last-used state.  Iis the called program still returning to its initial state?
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Mervyn Moderator
 
  
 Joined: 02 Dec 2002
 Posts: 415
 Topics: 6
 Location: Hove, England
 
 | 
			
				|  Posted: Tue Feb 04, 2003 5:16 pm    Post subject: |   |  
				| 
 |  
				| Disco_Stu, Are you the only one to have used this module since 1976?  Has no-one in your shop any experience here? 
 Cheers,
 Merv
 _________________
 The day you stop learning the dinosaur becomes extinct
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| nxn00 Beginner
 
 
 Joined: 02 Dec 2002
 Posts: 18
 Topics: 0
 Location: US
 
 | 
			
				|  Posted: Tue Feb 04, 2003 5:58 pm    Post subject: |   |  
				| 
 |  
				| I just tried to post a reply but it didn't appear. 
 Advice is to use a static call.
 
 We had the same problem at work this week with a program that was compiled DYNAM and tried to call an entry point in another program.  Changing compie option to NODYNAM solved the problem.
 _________________
 Natalie
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| DaveyC Moderator
 
  
 Joined: 02 Dec 2002
 Posts: 151
 Topics: 3
 Location: Perth, Western Australia
 
 | 
			
				|  Posted: Wed Feb 05, 2003 12:30 am    Post subject: |   |  
				| 
 |  
				| Sounds like you need a DLL, can you write them in OO COBOL ? I agree with Natalie, make it a static call. _________________
 Dave Crayford
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |