access to Natural work area from program run in SPoD ?

hello all,

i have a little problem that i hope you can shed some light on :

i have a program that basically reads a source into the work area (using USR2019N), manipulates it (using USR2014N) and then saves the source again. We would like to be able to run this program from all 3 development environments that are in use here (Natural, ISPF and SPoD) but the problem is that running this program from the SPoD command line gives me an error (NAT6504: SAG EDITOR buffer pool work file open error). Obviously, running a program from SPoD does not open a ‘normal’ online natural session, including work area etc.

Is this dependend on some local setting here or is this just the way it is with SPoD ? Does anybody know more about this ?

i appreciate any input you can give me,

Ronald Wijchers
Nordea L&P
Denmark

I’ve written tools which access the contents of the Source Work Area, and they run fine on the mainframe. In Natural Studio I’ve had trouble when multiple objects are open or have been opened. I haven’t done much testing while accessing a remote Development Server, but so far I’ve had no luck.

I’m just guessing, but the problem might be in finding the correct ED-SESNUM value.

Its the exit USR2014N that requires the SAG Editor. You apparently have defined a SAG Editor bufferpool/workfile in your Natural ISPF environment but not in you NDV server.

The profile parameter EDPSIZE is a bypass for the missing SAG Editor bufferpool/workfile.

thanks for the replies. While looking into this we also investigated the possibility to actually develop a separate application for SPoD and decided to go for that. So i started to read up on event driven programming… Probably a whole new bunch of questions will come from that (am i the only one who thinks that the documentation could be a bit clearer ?).

but thanks!

Ronald

Hi Ronald;

Assuming you mean Natural’s own event driven interface, stick with it. Reading is fine, “playing” is better. Pick a simple real application. In my case, going back to Natural Lightstorm & New Dimension days, I chose the subscription system for my newsletter (originally written in Fourth Dimension for the Mac). So, yes, I did have experience with event driven programming already.

Most of my event driven experience, however, was as a user of PC and web systems; experience I am sure you have.

Play with the more common Controls like List boxes, Ra dio buttons, push buttons, etc.

In less than a week you will probably be quite comfortable with event driven programming and will wonder why it seemed so complicated to start.

For whatever it is worth, some simple observations:

With PP (procedural programming), the “stream of control” is in code, which invokes objects like Maps. In EP (event driven programming), the “stream of control” is the dialogs, which have code int the “back of” the controls and the dialogs.

In some sense, a dialog is a Map with lots of Processing Rules in the background. A Control is similar to a Field on a Map with Processing rules.

Major difference: The “unit of work” for PP is a Map. You issue an INPUT statement, the user gets to tab around the screen entering/changing data, etc. All during this time, the program (even processing rules) has no idea what is going on. Only when a PF Key, or enter, is pressed, does your program “get control”. By contrast, with EP, the unit of work can be as small as a keystroke. For example, in my subscription system, there is a pull down action for “Select Company”. This invokes a Control which is a List Box. The initial list starts with the letter A. There is a place where I can type say M. The Control where the M is typed reacts to that single keystroke and refreshes the List Box starting from M. If I now type U, the List Box is now refreshed starting with MU, etc. Play with the various events for Controls like “Change”, “Enter”, and “Leave”. For example, have an Input Box. When control is passed to the Input Box (say someone clicks on it), change the color by writing code in an enter event.

It is really quite a bit of fun when you get past the first few days.

steve

But keep in mind: event driven programs do not run in a SPoD environment. This feature is available only if the program runs in Natural Studio locally.

Steve,

yes, i’ve been playing around quite a bit and the application is already finished, actually. And it was fun too !

What i found the most difficult was actually finding out where to put my ‘user code’ (that part that could not go into an event handler). There actually is a small part about that (this ‘options 2’ stuff) in the documentation but i only found that when i had already figured it out myself.

and Klaus, i’m not sure what you mean with a SPoD environment. Do you mean an environment where development is done with SPoD but all programs run on the mainframe ? I had not really expected that to work… The program i am making is supposed to run locally, since it works directly on the active editor window in SPoD.

Anyway, now we are on the subject: i actually have a comment/question.

when you design a map in SPoD and use a checkbox, you can link a logical directly to the checkbox so that checking it sets the logical to TRUE. I haven’t found a way to do this in a dialog. I have searched the documentation for an answer to this, but it seems that the only elements you can directly link to a variable are input fields and selection boxes. To me that seems a bit strange, that it is possible as long as you use old fashioned mainframe Natural but in the (supposedly) more advanced Event driven version you are back to programming it yourself. I know it’s easy enough to program that in the event handler but still, to me it seems like something that you would want to do in most cases so why not have an option for it?

thanks
Ronald

In the Dialog editor, a check box object is called a Toggle Button. It’s similar to a logical, but instead of testing for TRUE or FALSE, you interrogate the CHECKED property.

IF  #TB-1.CHECKED = CHECKED
  THEN
    ADD #DETAIL-AMT TO #TOTAL-AMT
END-IF

Of course you don’t have to keep the default name.

IF  #TB-TOTALS.CHECKED = CHECKED
  THEN
    ADD #DETAIL-AMT TO #TOTAL-AMT
END-IF

remove duplicate message

Ralph,

yes, i know. The thing is though, that what i have on my screen is a direct representation of the fields in a PDA. So what i would like is that when the user clicks a toggle button, the corresponding logical in the PDA changes value as well. As i said before, this is possible when you use a normal map with a toggle button on it but not when you use a dialog with the same toggle button on it.

I do realise what the technical difference is here: when you use a map it is actually your own own variable that is displayed on the map (as a toggle button). With a dialog a separate variable is created for it.

Anyway, i don’t want to complain too much, i still think it’s a great tool and i hope i get to work some more with it in the future…

thanks all !

Ronald

To bridge between the old and new technologies, you would have to place code into the CLICK event of each toggle button.

IF  #TB-TOTALS.CHECKED = CHECKED 
  THEN 
    ASSIGN #TOTALS-LOGICAL = TRUE
  ELSE
    RESET  #TOTALS-LOGICAL 
END-IF