|
Odds and Ends
Hey, Ted:
Question:
In the April
24, 2002, issue of the Midrange
Guru , you said, "I rarely sign on to two sessions
because I use group jobs." What are group jobs? I'm a
multi-session-addict, and I was surprised to see that you
rarely sign on to two sessions. Perhaps I'm
misunderstanding something. I usually open two, three, or
more Rumba windows, and in my understanding, that means
that I'm working with two, three, or more 'sessions.'
Perhaps I am using the term session incorrectly? How can
you use group jobs instead of multiple sessions?
Answer:
Group jobs let you have 16 sessions under one
sign-on. Each one has its own QTEMP library and its own
library list, for example. You can only see one session at
a time, however. You can't show two sessions side by side
on the display at once.
Here's how I use group jobs.
First, I put the following
CL commands in my initial program:
DCL VAR(&GRPJOBNAME) TYPE(*CHAR) LEN(10)
RTVGRPA GRPJOB(&GRPJOBNAME)
IF (&GRPJOBNAME *EQ *NONE) THEN(DO)
CHGGRPA GRPJOB(MAIN)
ENDDO
Next, I create the following attention-key program:
PGM
MONMSG MSGID(CPF0000) EXEC(GOTO ENDPGM)
TFRGRPJOB GRPJOB(*SELECT)
ENDPGM:
ENDPGM
Third, I assign the program I just created to the
attention key in my user profile using the Change Profile
(CHGPRF) command or Change User Profile (CHGUSRPRF)
command:
CHGPRF ATNPGM(MYATNPGM)
Sign off and on to make the necessary changes take
effect.
To start a new group job, press the Attention key. The
system responds with the Transfer to Group Job panel. Press
F6 to start a new group job. In the Group job prompt, fill
in a meaningful name for the group job. In the Initial
group program blank, type QCMD. I usually leave the Special
environment attribute as *DFT, but sometimes I type *S36
for a S/36 environment job.
Once you have other group jobs running, you will be able
to choose from them using option 1 on the Transfer to Group
Job panel.
There are other ways to use group jobs, but this works
well for programmers.
Question:
When I use option 14 within PDM to submit a compile
to batch, the system sends two messages to my interactive
job--PDM0018 (The compile of member SBMJOBX1C was submitted
to batch.), followed by CPC1221 (Job 308270/JSMITH/MYPGM
submitted to job queue MYJOBQ in library MYLIB). The second
of these interests me. I would like my programs to send
such a message, displaying job queue information, when they
run the Submit Job (SBMJOB) command. Is this
possible?
Answer:
Yes. Receive the message and send it to the *PRV message
queue. Here's an example:
DCL VAR(&MSGID) TYPE(*CHAR) LEN(7)
DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(256)
DCL VAR(&MSGF) TYPE(*CHAR) LEN(10)
DCL VAR(&MSGFLIB) TYPE(*CHAR) LEN(10)
SBMJOB CMD(whatever) JOB(whatever)
RCVMSG MSGTYPE(*LAST) RMV(*NO) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) TOPGMQ(*PRV)
Question:
I am working on a project that requires me to specify
TGTRLS(*PRV) and DBGVIEW(*SOURCE) every time I compile a CL
or RPG source member. First I would prompt options 14 and
15 of the Work with Members using PDM (WRKMBRPDM) command
display and fill in the blanks. That got old quickly. It's
not possible for me to change the defaults for the
CRTxxxPGM and CRTxxxMOD commands. Do you know of any way
for me to avoid keying these options every time I
compile?
Answer:
On the command line at the bottom of the WRKMBRPDM
screen, type dbgview(*source) tgtrls(*prv) and press the
Enter key. OS/400 responds with the message CPD0033 (String
beginning 'DBGVIEW ' not valid command name). This places
the compile options into the log of previous commands and
allows you to retrieve the options by pressing the F9 key.
When you need to compile a source member, type the option
14 or 15 and press F9 until the compilation options appear
on the command line.
Question:
I need to connect from one of our AS/400s to one of
our NT Servers to update a table. Is there a way to do this
with Java? Please help or direct me where to find
information on how to do it.
Answer:
T'is a simple thing! Get a Pure Java JDBC driver for the NT
database and write a JDBC application.
Question:
Is there a quick way to throw together a one-shot
data entry subfile program?
Answer:
You can build subfile-type data-entry programs with DFU.
I don't recommend them for production applications, but
they're acceptable for one-time jobs.
Start DFU by typing STRDFU and pressing Enter. Choose
option 2 to create a DFU Program.
I won't go through the process screen-by-screen. I'll
just point out the two places where you must fill in
certain values in order to get a subfile application.
- On the Define General Information display, choose
option 4 (Row oriented) for Display Format.
- When you get to the Work with Record Formats display,
use option 2 to select the appropriate record format and
enter Y under Multiple Records.
DFU also lets you specify autoincrement, autoduplicate,
and accumulation. To get those features, select option 2
(Specify extended definition) on the Work with Fields
display.
DFU is not pretty, but it works and it certainly beats
writing a program that will only be used once.
I've mentioned DFU because it's available on most OS/400
machines. Another alternative is to use the free WRKDBF
program, which is available for download from www.wrkdbf.com . This
program generates work-with screens for database files.
You can also buy programs that generate work-with
programs.
|