I work as a programmer in a call center. The call center people are
pulling forms on the terminal and some times enter/modify data to
update the DB2 in the back end. They are too busy to approach and
bother with mundane questions. Besides I believe learning from Usenet
groups is a must for a buddinig AS400/DB2 programmer.
Now my question: can someone please tell me how to list all of the
available forms in iSeries/Navigator?
What I want to do is open a form, enter some data and update the DB2.
Then I want to run a query that calls a stored procedure in the
backend for update.
So I need 2 things:
a) list of forms
b) list of stored procedures behind the form
I am now facing another problem. With STRSQL (iSeries/Navigator SQL
pre-compiler)
I am unable to run a stored procedure with question mark ("?"). For
exampel if sp1 is a stored procedure, when I type "CALL sp1(?)" I get
"use of parameter marker not valid" message. Someone told me that it
is because there is no working memory in the iSeries/Navigator to
store temporary results.
This is my wish list for Christmas. :) Please help
Thanks
What's a "form"? Are you meaning a display-file?
>
> I am now facing another problem. With STRSQL (iSeries/Navigator SQL
> pre-compiler)
> I am unable to run a stored procedure with question mark ("?"). For
> exampel if sp1 is a stored procedure, when I type "CALL sp1(?)" I get
> "use of parameter marker not valid" message. Someone told me that it
> is because there is no working memory in the iSeries/Navigator to
> store temporary results.
The parameter marker '?' is only for prepared statements, with
iSeries/Navigator you run immediate statements only. You can use
prepared statements only in HLL programs.
--
Dr.Ugo Gagliardelli,Modena,ItalyCertifiedUindoscrasherAñejoAlcoolInside
Spaccamaroni andate a cagare/Spammers not welcome/Spammers vão à merda
Spamers iros a la mierda/Spamers allez vous faire foutre/Spammers loop
schijten/Spammers macht Euch vom Acker/Spamerzy wypierdalac'
Out here a form is a display of data with labels and value fields.
The form is displayed on a terminal or black
and white screen. Sometimes there is an applet that runs on a web
browser. To make matters simple,
a form is a view of the data stored in a DB2 table. The data to
populate the form are obtained by running
a stored procedure. For instance, a person will have an address and
telephone number so you can create
a form with labels like firstname, lastname, street, city, state,
postal code, telephone number, etc.
Next to these labels the user can enter the values. e.g soup for
firstname, power for last name, street is
10 Mystreet, etc. Once the form is filled, the user will submit the
form so that the backend table(s) is updated.
Next time around, the user can search by name, address, telephone
number, etc. and the stored procedure
retrieves the saved data and populates the form.
Sorry I don't have a screen shot to place it on the web.
>
>
> > I am now facing another problem. With STRSQL (iSeries/Navigator SQL
> > pre-compiler)
> > I am unable to run a stored procedure with question mark ("?"). For
> > exampel if sp1 is a stored procedure, when I type "CALL sp1(?)" I get
> > "use of parameter marker not valid" message. Someone told me that it
> > is because there is no working memory in the iSeries/Navigator to
> > store temporary results.
>
> The parameter marker '?' is only for prepared statements, with
> iSeries/Navigator you run immediate statements only. You can use
> prepared statements only in HLL programs.
Thanks for the clarification. I know how to call a procedure from a
High Level Language like Java/JDBC.
Is it pretty much the only way?
Thanks
Hi Dr.Gagliardelli: I now understand the limitations of iSeries/
Navigator. It seems there is little one can do
to run a stored procedure without HLL. To digress, what is the
technical reason this is not done?
I am not a predominantly stored procedure programmer. I understand PL/
SQL but never actually
tried it in large-scale. Some people around me use PCML. Could you
please comment on the relative
merits/de-merits of stored procedures and PCML?
Also, I need to code a form for data entry and I am hard-pressed to
find a solution. Your kind help is
appreciated.
Thanks
> I am not a predominantly stored procedure programmer. I understand PL/
> SQL but never actually
> tried it in large-scale. Some people around me use PCML. Could you
> please comment on the relative
> merits/de-merits of stored procedures and PCML?
I know a PCML achronym that stands for Program Call Markup Language,
that give the mean to call as400 programs, non stored procedure, and is
limited to Java. I do not like very much PCML because it uses an xml
"document" describing the calling interface of the program, that's not
flexible enough for my needs, for example it force you to call a program
always in the same library, that's can be good if you need to call a
system API, they're always located in QSYS library, but it's unuseful as
most of system API are already wrapped in java classes inside as400 toolbox.
With stored procedure you can wrap non-SQL programs and still call via
SQL interface.
>
> Also, I need to code a form for data entry and I am hard-pressed to
> find a solution. Your kind help is
> appreciated.
I still do not understand what kind of object could be a "form", I
understood that it's maybe a sort of panel where the user can interact,
but such panels can be made in several ways.
Thanks for the clarification. Do you think the limitation is because
of
DB2 or AS400? Thinking out of the box, is it a limitation of
iSeries/Navigator? Is there another interface I should be using?
We have excellent admin support but not programming. The admin
may be able to install any fixpacks (we are running 2005 version of
iSeries/Navigator).
>
> > I am not a predominantly stored procedure programmer. I understand PL/
> > SQL but never actually
> > tried it in large-scale. Some people around me use PCML. Could you
> > please comment on the relative
> > merits/de-merits of stored procedures and PCML?
>
> I know a PCML achronym that stands for Program Call Markup Language,
> that give the mean to call as400 programs, non stored procedure, and is
> limited to Java. I do not like very much PCML because it uses an xml
> "document" describing the calling interface of the program, that's not
> flexible enough for my needs, for example it force you to call a program
> always in the same library, that's can be good if you need to call a
> system API, they're always located in QSYS library, but it's unuseful as
> most of system API are already wrapped in java classes inside as400 toolbox.
> With stored procedure you can wrap non-SQL programs and still call via
> SQL interface.
I got some more info about PCML at
http://publib.boulder.ibm.com/iseries/v5r2/ic2924/index.htm?info/rzahh/pcmlproc.htm
I was curious about your comparison of the two. I am glad you gave me
the scoop. :)
> > Also, I need to code a form for data entry and I am hard-pressed to
> > find a solution. Your kind help is
> > appreciated.
>
> I still do not understand what kind of object could be a "form", I
> understood that it's maybe a sort of panel where the user can interact,
> but such panels can be made in several ways.
I am not very good at IBM/AS400/DB2 terminology. May be it is a panel
I am after. As long as the panel
accepts some input and stores it in the DB that'd be of great help. I
however
need some minimal code to get started. People tell me I am a fast
learner. :)
May be you have a URL that explains how it is done. Unfortunately
searching
google with the key words "db2 as400 panel" is not yielding any
results with some
code examples. So your help is very much appreciated.
http://www.google.com/search?hl=en&q=db2+panel+as400&aq=f&oq=
Thanks
You might have to take it up with your manager or the application
vendor. You seem to want to fire away queries/SPs on the database etc
but have no fundamental understanding of the environment nor the
application layer and sound a bit flaky on the database side (eg. PL/SQL
is in Oracle not DB2). The lack of support from anyone else in
organisation just sounds really suspicious.
The worse part is you've got access to some tools through which you can
play. Be really careful mate as you can do some major damage to the data
integrity of the app.
RJ.
As mentioned in other posts, parameter markers are an SQL programming
mechanism for input and/or output of data using dynamic SQL statements.
But the "forms" you mention seem to be a part of an application (or
perhaps "middleware") layer, distinctly separate from DB2.
As I mentioned on comp.databases.ibm-db2, the iNav "Run SQL Scripts"
function does support parameter markers for OUT parameters of stored
procedures (see web link there), but not INOUT parameters, because there
is no simple way to both provide an input value -and- have DB2 return an
output value for the same parm.
<snip>
>
> I am not very good at IBM/AS400/DB2 terminology. May be it is a panel
> I am after. As long as the panel
> accepts some input and stores it in the DB that'd be of great help. I
> however
> need some minimal code to get started. People tell me I am a fast
> learner. :)
> May be you have a URL that explains how it is done. Unfortunately
> searching
> google with the key words "db2 as400 panel" is not yielding any
> results with some
> code examples. So your help is very much appreciated.
>
> http://www.google.com/search?hl=en&q=db2+panel+as400&aq=f&oq=
>
One problem with your search terms is that the platform has never been
called "as400". Circa 1988 (when introduced) it was called AS/400
(short for Application System/400), and has since been renamed iSeries,
System i, etc.
One type of panel support (for 5250, or "green-screen" interface) is the
User Interface Manager (UIM). Here is a link found by searching using
the terms "iseries uim panel" :
http://systeminetwork.com/article/apis-example-uim-work-management-apis-part-1
The UIM may be interesting background info, but as mentioned by others,
it would most likely be useful only in the context of application
programming. If you have no real programming support, using UIM to
accomplish your goal is probably not an option.
--
Karl Hanson
>> I still do not understand what kind of object could be a "form", I
>> understood that it's maybe a sort of panel where the user can interact,
>> but such panels can be made in several ways.
>
> I am not very good at IBM/AS400/DB2 terminology. May be it is a panel
> I am after. As long as the panel accepts some input and stores it in the
> DB that'd be of great help. Ihowever need some minimal code to get
> started. People tell me I am a fast learner. :)
> May be you have a URL that explains how it is done. Unfortunately
> searching google with the key words "db2 as400 panel" is not yielding any
> results with some code examples. So your help is very much appreciated.
DB2 doesn't supply any mean to describe input/output panel, You should
build your own panel in one of the several methods available, such a
command definition, a display file managed by a program, a UIM panel
managed by a program as well, a java program that access db2 via jdbc
and show an input/outup form eg with swing, a MS access program that
access db2 via odbc, a jsp that access db2 via the applicaion server, an
html page panaged by a CGI program and so on.
So you understand that when you decided where the user interface will be
executed, then there still are lots of ways to build your application.
Dr.Gagliardelli
I understand how to build a form in HLL using browser. I want to build
a form on the command line. It is
the way my company operates. The call center employees have a login
for AS400/DB2. Once they are
login they type "GO CLP6". Then they are shown the search criteria.
They enter the search criteria
and then view a form on the black&white screen. To draw a parallel
unix has a "CURSES" library
that allow a dumb terminal interaction with a form. In other words,
the user logs on on to Unix on a dumb terminal
and enters a command. The user is then shown a form to enter data. By
form, I mean a 2 dimensional
view with fields and labels as I described before. I know for sure
that AS400/DB2 has this feature.
However, I don't know how to create one. If you happen to know this
please let me know.
Thanks
Here are links to curses library
http://en.wikipedia.org/wiki/Curses_(programming_library)
http://www.wrkgrp.com/support/Curses.html
http://www.innosys.com/curses.pdf
Thanks
The GO CLP6 command will call a *MENU object by the name of CLP6. A *MENU
object is managed by SDA (Screen Design Aid). So in order to change the menu
you would enter STRSDA and select option 2
There you can change menu texts and if you enter F10 you will see the code
that is executed once a menu selection has been made.
If you see a CALL PGM(xxkxx) then this is a userdefined HLL program (COBOL,
RPG, C etc.) that is being called. If you see CHGDTA DFUPGM(xkxkxk) then
this is a predefined DFU (Data File Utility) program, which is managed
through the STRDFU command. If you see UPDDTA FILE(xxxxx) then this is a
simple temporary DFU program which will allow you to update a specified
table/physical file, index/view/logical file.
SDA ref:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/c0926040.pdf
DFU ref:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/c0917730.pdf
I hope this helps a little...
Hi Kaj:
I found more info on Screen Design Aid (SDA) with some examples at
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/books/c0926040.pdf
I was able to design a screen but not see the input buffer or save the
data entries to a file or DB table.
Could you tell me how I can save the data?
Thanks
Try defining a command with the parameters you want the users to
enter. I think this will be the easiest replacement for curses. Then
set this command to call a CL program accepting the parameters you
defined above. Then try strqmqry passing these parameters to the sql
you chose. You may want to add a parameter checking program to the
command too. Say to prevent more than one years worth of data being
requested if you have start & end dates, or maybe to verify a customer
code is correct before the query runs & gives no output. Finally once
its working change CLP6 to have this command as a new option.
You will find both command & CL programming examples in this group as
well as in the website Kaj describes. You should check what version
you have to avoid disappointment if you're looking at new fieatures
for V6 but still running V4.5.
Jonathan.
Hi Jonathan
Thanks for your detailed reply. Could you tell how to add a COMMAND in
the iSeries/Navigator?
Kindly see my code for stored procedure PRMTST posted in this thread.
How can I convert this to a CL program?
I think having inputs at this time is a pipe dream for me ;) If I can
call a CL program without inputs and parameter
checking that will be a great stride for me.
Please post any URL's that explain this. The DFU and SDM url's don't
cover CL
Thanks
Hi Jonathan: I have an update
I was able to create a DFU program as follows:
1) entered STRDFU on the AS400 command
2) selected option 2 to create a DFU program MYPROGRAM
3) specified the library
4) in the SELECT AND SEQUENCE FIELDS screen selected 2 DB2 TABLE
fields: FIELD1 (set the sequence to 1; it is also the primary key) and
FIELD2 (set the sequence 2)
5) provided HEADING in the Work with Fields screen
6) chose 2 to specify extended definition in the same screen
7) Saved the DFU program
Run the program as:
1) STRDFU on command
2)Entered value for FIELD1 (primary key)
3)AS400 displayed the FIELD2
This is pretty cool. Here are my unknowns:
a)How can I search by FIELD2? Is the search based on primary key only?
b)how to do parameter checking?
c) how can I make MYPROGRAM as a command in the CL?
Thanks
Found a link to creating commands:
http://publib.boulder.ibm.com/html/as400/v4r5/ic2924/index.htm?info/cl/crtcmd.htm
But this says: "To create a command, a set of command definition
statements are entered into a source file"
Is there any other way to create a command?
Thanks
The command definition statements define parameter attributes etc. I'm
not aware of a "command design aid" analogous to SDA. However if you
create a source member of type CMD, SEU supports prompting for the
various command definition statements. On a command line:
===> go CMDCMDDEF
===> STRSEU SRCFILE(MYLIB/QCMDSRC) SRCMBR(MYCMD) TYPE(CMD)
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rbam6/defcm.htm
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rbam6/exdcc.htm
--
Karl Hanson
I think you need a basic AS400 programmers course. However you will
need to start with crtsrcpf to make a file for your sourcefiles. Then
wrkmbrpdm to show you the members in the file. If you dont have that
then its a touch harder & you have to use something like STRSEU SRCFILE
(MYLIB/QCMDSRC) SRCMBR(MYCMD) TYPE(CMD) as Karl suggests. PDM makes it
easier as you can use option 14 to compile sources & 4 to delete
instead of rmvm etc
Typically programmers use different files for their RPG/CL/DDS but
there is no rule not to just throw them all in together. Different
object types eg Programs & FIles can have the same name so this is one
reason.
To search by field2 using DFU you need a key over the physical by
field2. Try DSPDBR lib/file which shows your existing logical files.
Then DSPFD for each of these. If none exists you need to create a new
one.
Add a sourcemember in the srcpf with a new name a bit like this:
A R RECORDFMT PFILE(FILENAME)
A K FIELD2
You have to have the A in col 6 & the R/K in col 17 & Pfile in 45.
Recordformat is the same as you get from dspfd on your db file.
Then 14 from PDM or CRTLF to create the logical. It dosnt have to be
in the same library as the rest of the db which keeps your stuff
separate from the rest of the application.
Now create a new dfu program using the logical.
To add your programs to the CL I assume you mean add to the menu? If
you are lucky then DSPOBJD CL06 *MENU then option 8 will give you the
location of the existing source. You can copy this then change it
using PDM/SDA. If not then I would suggest creating a new menu with
SDA. Tell the users to GO XXX or whatever you call it.
Jonathan.
Hi Karl
It looks like I have to create a source file QCMDSRC. When I typed
STRSEU SRCFILE(MYLIB1/MYPROGRAM) SRCMBR(MYCMD) TYPE(CMD)
The error was: FILE MYPROGRAM IN LIBRAY MYLIB1 NOT SOURCE PHYSICAL
FILE
I understand the error. My question is how do I create/save the source
file?
Thanks
I was able to type CRTSRCPF and see a screen name "CREATE SOURCE
PHYSICAL FILE".
I then entered the following fields with my values:
File: MYPROGRAMF
Library: MYLIB1
Record length : 92 (default)
Member, if desired : HELLO
Text 'description' : *BLANK
The file was created
However when I type WRKMBRPDM I get a listing in the screen Work With
Members Using PDM
containing the FILE NAME and LIBRARY. However it says "No members in
file". So I couldn;t
edit the file (option 2)
>& you have to use something like STRSEU SRCFILE
> (MYLIB/QCMDSRC) SRCMBR(MYCMD) TYPE(CMD) as Karl suggests. PDM makes it
> easier as you can use option 14 to compile sources & 4 to delete
> instead of rmvm etc
> Typically programmers use different files for their RPG/CL/DDS but
> there is no rule not to just throw them all in together. Different
> object types eg Programs & FIles can have the same name so this is one
> reason.
>
> To search by field2 using DFU you need a key over the physical by
> field2. Try DSPDBR lib/file which shows your existing logical files.
I tried DSPDBR MYLIB1/MYPROGRAM
I am getting the error File MYPROGRAM doesn't exist in MYLIB1
> Then DSPFD for each of these. If none exists you need to create a new
> one.
> Add a sourcemember in the srcpf with a new name a bit like this:
> A R RECORDFMT PFILE(FILENAME)
> A K FIELD2
> You have to have the A in col 6 & the R/K in col 17 & Pfile in 45.
> Recordformat is the same as you get from dspfd on your db file.
> Then 14 from PDM or CRTLF to create the logical. It dosnt have to be
> in the same library as the rest of the db which keeps your stuff
> separate from the rest of the application.
> Now create a new dfu program using the logical.
> To add your programs to the CL I assume you mean add to the menu? If
> you are lucky then DSPOBJD CL06 *MENU then option 8 will give you the
> location of the existing source. You can copy this then change it
> using PDM/SDA. If not then I would suggest creating a new menu with
> SDA. Tell the users to GO XXX or whatever you call it.
>
> Jonathan.
I will work on this part and let you know how it goes. If you could
please
answer the previous two, I'd be eternally grateful.
Thanks
As Jonathan mentioned, an introductory course or book to understand
concepts may be more efficient than progressing one step at a time via
newsgroups like this.
Your CRTSRCPF should have created a source physical file and added a
member called HELLO to it. I don't know why the WRKMBRPDM member list is
empty, but you can add new members on that panel using F6.
>
>> & you have to use something like STRSEU SRCFILE
>> (MYLIB/QCMDSRC) SRCMBR(MYCMD) TYPE(CMD) as Karl suggests. PDM makes it
>> easier as you can use option 14 to compile sources & 4 to delete
>> instead of rmvm etc
>> Typically programmers use different files for their RPG/CL/DDS but
>> there is no rule not to just throw them all in together. Different
>> object types eg Programs & FIles can have the same name so this is one
>> reason.
>>
>> To search by field2 using DFU you need a key over the physical by
>> field2. Try DSPDBR lib/file which shows your existing logical files.
>
> I tried DSPDBR MYLIB1/MYPROGRAM
>
> I am getting the error File MYPROGRAM doesn't exist in MYLIB1
>
The first parameter of DSPDBR must name a file (*FILE) object. Is
MYPROGRAM a *FILE object, or another type of object (eg *PGM)? Using a
command like DSPLIB or WRKOBJPDM, you can see each object's type in the
Type column. Here is a link with some object concepts:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rbam6/rbam6objects.htm
--
Karl Hanson
1) entered STRDFU on the AS400 command
2) selected option 2 to create a DFU program MYPROGRAM
3) specified the library
4) in the SELECT AND SEQUENCE FIELDS screen selected 2 DB2 TABLE
fields: FIELD1 (set the sequence to 1; it is also the primary key) and
FIELD2 (set the sequence 2)
5) provided HEADING in the Work with Fields screen
6) chose 2 to specify extended definition in the same screen
7) Saved the DFU program
Run the program as:
1) STRDFU on command
2)Entered value for FIELD1 (primary key)
3)AS400 displayed the FIELD2
This is pretty cool. Here are my unknowns:
a)How can I search by FIELD2? Is the search based on primary key only?
b)how to do parameter checking?
c) how can I make MYPROGRAM as a command in the CL?
-- snip ---
a) DFU always search by the key of the file (Physical or Logical) the DFU
program uses. If you want another key, you will have to use another LF
(Logical file), which in this case is analogous to an SQL index. So, if
there isn't already a LF/Index in place, you'll have to create one with the
desired key. You can either use the DDS/CRTLF combination or use SQL CREATE
INDEX.
b) In the "Specify Extended Field Definition" panel you can choose to change
the validity check. This will lead you to the "Specify Validity Checks"
where you'll se a "Relational operator field". Here you have some options.
If you want to be sure that only values between 7 an 11 is entered in a
field, you would enter enter RG (short for Range) here and 7 11 in the "List
of values" field. If you just want to be sure that a nonzero value is
entered then you'd use NE (not equal) and 0 in the "List of values" field. I
hope you get the picture.
c) I think you mean "How can I call this DFU program from the menu like
CLP6?". The answer is that you will have to create or edit the menu using
SDA option 2. The command to enter for the menu option is CHGDTA
DFUPGM(yourlib/MYPROGRAM)
I hope this makes sense to you...
Hi Kaj: Many thanks for the details. The points (a) and (b) are very
good. I am able to implement them
I tried C as follows:
STRSDA -> select option2 in Screen Design Aid (SDA) > In Design Menus
screen sourcefile=MYPROGRAM, library=MYLIB, Menu=hello > return on
Specify Menu Functions > return on Exit SDA Menus (got the message
Menu HELLO saved in MYLIB/MYPROGRAM and compiled in MYLIB >Specify
Menu Functions screen enter return -> nothing happens after this...
where am I going wrong?
When I type CHGDTA DFUPGM(MYLIB/MYPROGRAM) I get the form.
I am still not able to define a GO command. Please help.
I tried C as follows:
STRSDA -> select option2 in Screen Design Aid (SDA) > In Design Menus
screen sourcefile=MYPROGRAM, library=MYLIB, Menu=hello > return on
Specify Menu Functions > return on Exit SDA Menus (got the message
Menu HELLO saved in MYLIB/MYPROGRAM and compiled in MYLIB >Specify
Menu Functions screen enter return -> nothing happens after this...
where am I going wrong?
-- SNIP --
When you see the "Specify Menu Functions" panel, you have to choose to Work
with menu image and commands (enter Y in the select field).
Then you will see your HELLO menu. Edit this menu until it suits you.
Then use the F10 command to go to the "Define Menu Commands" panel. Here you
enter the commands that will execute the code you want executed.
If you fx. had a menu option 1 like "Change Item Data" you could enter
something like CHGDTA DFUPGM(MYLIB/MYPROGRAM) in the Command field for
option 01.
After exiting and creating the menu you would be able to enter GO HELLO and
your menu would be shown.
Hope this helps...
Yes so far so good
> c) I think you mean "How can I call this DFU program from the menu like
> CLP6?". The answer is that you will have to create or edit the menu using
> SDA option 2. The command to enter for the menu option is CHGDTA
> DFUPGM(yourlib/MYPROGRAM)
This doesn't work on my system. I get the HELLO Menu with 1-10, I
selected 1 and entered the command
as you stated. However, I still can't use "GO HELLO"
Sorry to bug you. But I need some help.
Thanks
So if you do wrkobj mylib/hello you get 3 items all called hello, a
msgf, file & menu?
If not then you didnt compile it properly usinf SDA. If you have them
then go mylib/hello to make it work. Alternatively addlible mylib then
go hello.
Jonathan.