I still confused about how using user space can only need once to retrieve its value. I think the user space is same with data area but with more large size and better performance. This is what i think : - set user space value to pgm1v001 (example) - change pgm1 and recompile it - set user space value again to pgm1v002 - pgm caller : Dow forever { Get user space value; If last US value current US value { Last user space value = current user space value; pgmname = dummypgm; Call pgmname; pgmname = pgm1; Call pgmname; }Else; Call pgmname; } } I am curious about that because i need to implement the program change soon to prod env, and still with old style. I am afraid the job will be MSGW. (Reply using mobile phone, sorry if the format is not good)
Announcement
Collapse
No announcement yet.
Compile RPGLE effect
Collapse
X
-
You are not correct. As I said earlier using a data area requires that you perform an RPG IN operation before each-and-every call. With a User space you resolve the pointer once during program initialization and that is it. So one operation during initialization compared with an operation on each and every call.
I can't really read your code due to formatting but I _think_ this is what you said:
Code:Dow forever; Get user space value; If last US value current = US value; Last user space value = current user space value; pgmname = dummypgm; Call pgmname; pgmname = pgm1; Call pgmname; Else; Call pgmname; EndIf; EndDo;
There is no reason to suppose that you will have any problems with this approach BUT you can avoid MSGW simply by handling the problem yourself. You can do this by adding an (E) extender to the call and checking %Error after the call (this is the current version of the old error indicators used in your original code I think). You could also use a MONITOR block and trap any error that way. But trapping the error is not enough by itself as all it does is prevent the MSGW. Having detected it you need to take steps to a) resignal the dataqueue message (or whatever triggered the program in the first place) and b) Kill the job so it will all start over.
Comment
-
This is the code that I mean :
Code:pgmname = pgm1; Get user space value; Save to Last user space value; Dow forever; Get user space value; If last User Space value <> current User Space value; Last user space value = current user space value; pgmname = dummypgm; Call pgmname; pgmname = pgm1; Call pgmname; Else; Call pgmname; Endif; EndDo;
Comment
-
My comments are the same. Delete the Else and move Call pgmName outside of the If.
If you are using a User Space there is no "Get user space value;" value required. The value will just "be there". You would define the variable holding it to be (for example):
Code:dcl-s programVersion timestamp Based(p_programVersion);
Code:dcl-pr GetPointer extpgm('QUSPTRUS') ; *n char(20) const ; // Name *n pointer ; // Pointer to user space *n char(32767) options(*varsize:*nopass) ; // Error feedback end-pr ; GetPointer('@USRSPACE QTEMP': p_programVersion ) ;
NOTE: As I said before the "Dummy" program MUST exist for this whole thing to work.
Comment
-
*N just means that you are not supplying a name. In fixed form you would just leave the columns blank - but in free the compiler needs to know when the name ends.
In fixed form it looks like this:
Code:d GetPointer Pr extpgm('QUSPTRUS') ; d 20a const d * d 32767a options(*varsize:*nopass)
Comment
Comment