Natural API USR0201N



Software AG's platform-independent programming language with full support for open-source and Internet applications

Natural API USR0201N

Postby Arkantos » Wed Sep 15, 2010 10:48 am

Hi All,

I tried to create an object dynamically using USR2014N, and able to write in the SWA using USR2019N and able to save that object. When i tried to stow the object using USR0210N, the return code is 0(ERR is 0) , still object doesnt get stowed.

While going thru the documentation, I found the below explanation.

---
Once the subprogram(USR0210N)has returned to the calling program
with ERR=0, the NATURAL STACK will have been modified.
The caller has to issue a STOP statement to give control
to the STACK mechanism.
.
On the STACK, there are now commands that start the wanted function.
.
A Natural module will be catalogued or stowed via the Natural stack,
because it is not possible to call the Natural compiler from a Natural
module. With USR1052N (Send a command to the operating system) a user
may start a batch Natural and catalog an object in a separate Natural
batch session.
---


1. Natural module cannot be cataloged/Stowed using a module?
2. I want to stow the saved object using a module. Is there any other way to do that?


Note: I am calling these three subprograms in a single program one after the other.

Cheers
Arkantos
Arkantos
 
Posts: 18
Joined: Fri Apr 16, 2010 10:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: Natural API USR0201N

Postby ats » Wed Sep 15, 2010 2:10 pm

Hi Anbu

I need to know what actions (passed parameters) you are taking after calling USER0210N. I assume you're passing something similar to this:

Save, cat, stow NATURAL source:
-------------------------------

Action .................... STOW__
Name of source ............ TEST07
Library ................... my-lib
Read source into editor ... N
Type of source ............ P


Press any PF-key to stop.,


I used the above details and was able to STOW the code in SWA (currently USR0210P) into my-library as TEST07. Attached are the before/after screen captures.

Regards,
Ats
You do not have the required permissions to view the files attached to this post.
ats
 
Posts: 14
Joined: Mon Sep 06, 2010 12:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Natural API USR0201N

Postby RGZbrog » Wed Sep 15, 2010 2:13 pm

1. Natural module cannot be cataloged/Stowed using a module?

The documentation does not lie. You certainly are not the first to be frustrated by this.

2. I want to stow the saved object using a module. Is there any other way to do that?

Use the API to save the source, then either stack a CAT command or submit a batch job via NATRJE. Both these methods are asynchronous, so if you need to guarantee the result, you'll have to test for success. With Entire System Server you can check the return code of the job. With vanilla Natural you can see whether the object exists in the target library and check the time stamp (via API).

If you are very careful (and with a bit of luck), you may be able to stack your utility program after the CAT. If you stack enough control data, you may be able to pick up where you left off when you executed the STOP statement.
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: Natural API USR0201N

Postby ats » Wed Sep 15, 2010 2:26 pm

I checked (as it was my attempt to STOW from SWA) on CAT with already saved but not cataloged object. The API USR0210N did work perfect for me. Hence I dare to say:

1. Natural module cannot be cataloged/Stowed using a module?

No, it can be with the API USR0210N

2. I want to stow the saved object using a module. Is there any other way to do that?

Use the API USR0210N

I hope, I have taken it correctly :)

Regards,
Ats
ats
 
Posts: 14
Joined: Mon Sep 06, 2010 12:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Natural API USR0201N

Postby RGZbrog » Wed Sep 15, 2010 11:37 pm

Ats,

Arkantos wants to stay within his utility program as he makes multiple calls to USR0210N. This is not possible. Take a closer look at USR0210P, at the end of the module.
/* STACK has been modified. Execute the commands:
STOP

For the CAT and STOW to complete, you must return to the command prompt.

To simulate what Arkantos wants to do, change the STOP statement to IGNORE. Execute USR0210P and make several requests. Without leaving USR0210P, check the results with another mainframe session. You will see that the CATs and STOWs do not take place until you exit USR0210P.
User avatar
RGZbrog
 
Posts: 101
Joined: Mon Nov 23, 2009 1:34 pm
Location: California, USA
Has thanked: 0 time
Been thanked: 0 time

Re: Natural API USR0201N

Postby ats » Thu Sep 16, 2010 11:42 am

Agreed Ralph,

My point was it is possible using modules!

Regards,
Ats
ats
 
Posts: 14
Joined: Mon Sep 06, 2010 12:27 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Natural API USR0201N

Postby Arkantos » Fri Sep 17, 2010 8:53 am

Ralph,

Exactly thats what i was doing(removed STOP statement) and it was not stowing. So I issued a Stop command and it is stowing perfectly.

Thanks a ton Ralph and Ats.

Cheers
Arkantos
Arkantos
 
Posts: 18
Joined: Fri Apr 16, 2010 10:06 am
Has thanked: 0 time
Been thanked: 0 time


Return to Natural

 


  • Related topics
    Replies
    Views
    Last post