how to catch the error code....

hi all,

good morning .

i am going to create one program which will do following things

step 1: getting input from user (program name)
step2 : it has 2 throw a screen like program existing in common lib .

the thing is i have to search the program name in all library…
i can use stack statement to execute a program but i dont know how to catch the error mess …

one more doubt , is there any scan statement to scan the program in all library .
.
how to do this …

thanks in advance

  1. Error handling: use ON ERROR statement and/or set *ERROR-TA to the program to capture the error.

  2. on mainframe, SCAN command.

Is your platform mainframe or Open Systems?

Please clarify, Karthikeyan. Do you need to find references to a a specific Natural object? SCAN will interrogate source code, looking for a character string. You would provide the program name in that string. But controlling this process programmatically is difficult.

Or do you need to determine the library in which a specific Natural object has been Saved, Cataloged, or Stowed? In this case, use the Application Programming Interface provided in library SYSEXT. Use USR1054N to generate a list of Natural libraries. While looping through the library list, use USR1055N or USR4206N to test whether the selected program exists in each library.

Or do you need to verify whether a module is available for execution? Instead of listing every Natural library, use USR2026N to list the libraries in the Steplib chain. Then use USR1055N or USR4206N, as above.

The API modules have return codes which can be interrogated by your programs.

sorry guys ,
i forgot to my mention platform ,mine is mainframe

one more question to all

scan statement it will search only in one library,but my program wants to search in all library.

please help me

It is not 100% clear from your post what you are actually intending to achieve. Ralph did give you all the possible answers but which one is valid for you depends on what you are trying to do.

is it
(a) Find all references to a string, in this case a module name and where it might be CALLNAT’ed for example. In which case, it is not easy programatically and there are products available that would help such as Natural Engineer from Software AG or SMART-TS from IN-COM Data Systems.

(b) find what library(s) a module exists in; in which case Ralph gave you all you need.

(c) determine if a module can be executed from the current library; again Ralph gave you all you need.

Or you could download & install the product Natural Toolkit from Southern Cross Computing.
Toolkit runs on the Mainframe & it is FREE !
http://scctoolkit.atspace.com/
.
NB. Toolkit has a “Find Member” command which searches FUSER (or alternatively the FNAT) for a Natural program name and reports All Libraries in which the program exists.

sorry guys ,
now i will explain more about requirements …

normally in a program

program name :ews189p
lib name :common

define data
local
1 #a (a10)
end-define
move ‘10’ to #a
end

in program if we want to search for particular character we will use scan command in the program
right …

in similar way

i want to search particular program in all library …
like this

program name :ews189p
lib i want to search : prd05,prd04,prd03,common,tar and so on

how to do this

please help me …

From Ralph’s post of 4/23 (up about 5 posts from here), a full week ago:

"Or do you need to determine the library in which a specific Natural object has been Saved, Cataloged, or Stowed? In this case, use the Application Programming Interface provided in library SYSEXT. Use USR1054N to generate a list of Natural libraries. While looping through the library list, use USR1055N or USR4206N to test whether the selected program exists in each library. "

steve