The Calculator tool is a series of commands that allow you to use the
system as a simple add/sub calculator and provides an optional
listing. The CLCFILP file must be created first. Many members may
exist in the file thus allowing both temporary and permanent lists to
be created and changed. Each amount entered may have an optional
text description. The last date changed exists for each record.
Over the last several years the use of personal calculators has
increased dramatically. They are now everywhere. Unfortunately,
most of them do not produce a listing or allow a change to a value
that was entered previously. Consequently, any keying errors often
cause the entire list to be keyed again.
CALC can be an effective tool when you need to add up a list of
values and compare the sum to a previous total or you want to check
the values to ensure they were keyed properly. Being able to change
one or two values can be a lot easier than re-keying the whole list.
CALC can also be used for permanent amount lists such as as where you
make an entry every month either by adding a new month value or
changing one or more entries in the list.
Getting started with CALC
-------------------------
** You begin by creating the required file with:
CRTCALC CLCFILLIB(xxx)
This creates the CLCFILP file in the named library and defines
the file to allow the maximum number of members to be added.
Normally, you would create the file in a library on your
library list to allow the use of the *LIBL default on CALC.
** Then use CALC as:
CALC MBR(BASE) NBRDEC(0)
MBRTXT('My base member')
This creates the member and describes that the amounts entered
will not have any decimal positions. Whole numbers will be
entered for this definition.
The command begins by displaying an empty subfile. Use F6 to
enter 'add mode' where you can enter amounts to be added or
subtracted. Each record may have an optional text
description. After the Enter key is pressed, the prompt
re-appears to allow another amount to be entered. A total of
the amounts in the member is also displayed.
When the list is complete, press F3 to return to the subfile
display which now shows a record for each amount entered. The
amount total is also displayed. You may change or delete any
record. You may use F6 again to enter additional records.
When the list is complete, press F3. A prompt appears that
allows you to make a listing. If one of the listing options
is chosen, the DSPCALC command is used to produce a listing.
** DSPCALC can also be done at any time to create a listing such
as:
DSPCALC MBR(BASE)
** Since the data still exists in the member that was used, you
can make changes and add new records by using CALC again such
as:
CALC MBR(BASE)
The defaults allow the same data to be displayed and you may
make changes or add new records. If you have a different set
of amounts to be added, you can: 1) Use F9 to delete any
detail records and reset the total to 0. The same function
could be achieved by using REPLACE(*YES) on the CALC command.
2) Name a new member on CALC.
It would generally be a good idea to allow the first member
created with CALC to be reusable for any temporary set of
amounts that need to be entered. Additional member names
could be added for listings that may need to be modified at a
later point.
Decimal positions
-----------------
When a new member is created, the number of decimal positions to be
entered for each amount is defined. You may change the number of
decimal positions on the CALC command for the same member if
REPLACE(*YES) is specified.
If data exists in the member, it is not possible to change the number
of decimal positions.
The valid decimal and separator characters are determined by the job
decimal format. In the USA, this is '.' for the decimal point and
',' for the separator characters
Valid amounts
-------------
The amount should be left justified.
A valid amount can contain up to 15 digits.
A leading or trailing minus sign may exist to describe a negative
value.
If the number of decimal positions is 0, no decimal point may be
entered for an amount.
If the number of decimal positions is greater than 0, then each
amount entered must contain a decimal point and the correct number of
digits to the right of the decimal point.
Separator characters are ignored on input of the amount. When the
subfile is displayed, the amounts are edited according to the rules
for the RPG '1' edit code. Separator characters will exist if
needed.
Entering and displaying amounts
-------------------------------
When entering a new amount, the data should be entered left justified
(it cannot begin with a leading blank). When changing an existing
amount, the data is edited and appears left justified.
When the data is displayed in the subfile (or by DSPCALC), the edited
data is right justified.
CALC escape messages you can monitor for
----------------------------------------
None. Escape messages from based on functions will be re-sent.
CRTCALC Command parameters *CMD
--------------------------
CLCFILLIB The library where the CLCFILP file will be created.
SRCLIB The source library to use for the QATTDDS file
source. The default is *TAAARC.
A specific user library may be named, but the source
file name must be QATTDDS.
AUT The authority to the CLCFILP physical file.
*USE is the default.
*CHANGE or *EXCLUDE may be specified.
DLTCALC Command parameters *CMD
--------------------------
CLCFILLIB The library where the CLCFILP file exists that will
be deleted.
CALC Command parameters *CMD
-----------------------
MBR The member of the CLCFILP file to be used. BASE is
the default.
If the member does not exist, it will be added to
the file.
If the member exists, it will be used.
MBRTXT The text description of the member.
*DFT is the default.
If the member does not exist, default text will
be assigned.
If the member exists, no change in the text
occurs.
A text description of up to 42 bytes may be entered.
If the member does not exist, the text will be
used as the first 42 characters of the member
description.
If the member exists, the first 42 characters
of the member text will be changed to the new
value.
The member text assigned to the member is 50 bytes.
The first 42 are from the MBRTXT value. The last 8
describe the number of decimal positions to be used
for the member. This value should only be changed
using the CALC command.
NBRDEC The number of decimal positions that must be entered
for each amount.
*DFT is the default.
If the member does not exist, 0 is used and all
amounts must be entered without a decimal
point.
If the member exists, the previous value is
used when entering an amount.
A number between 0 and 9 may be entered.
If the member exists and the value is the same
as the previous value, processing continues
normally.
If the member exists, contains data records,
and the number of decimal positions value
differs from the previous value, you must
specify REPLACE(*YES). This causes all data
records to be cleared and the new value becomes
the definition for the number of decimal
positions for how amounts should be entered.
If the member does not exist, the value defines
the number of decimal positions for any amount
entered.
REPLACE A *YES/*NO parameter for whether to replace the data
in the specified member. *NO is the default to
allow additional records to be added to the member.
*YES may be specified to clear the member. The F9
command key may also be used on the subfile display
to clear the member.
CLCFILLIB The library where the CLCFILP file exists. *LIBL is
the default. A specific library or *CURLIB may be
entered.
DSPCALC Command parameters *CMD
--------------------------
MBR The member to be displayed. BASE is the default
CLCFILLIB The library where the CLCFILP file exists.
OUTPUT How to output the results. * is the default to
display the spooled file if the command is entered
interactively. The spooled file is deleted after it
is displayed if DSPSPLF is ended with F3/F12 or the
Enter key. To retain the spooled file, you may use
the the System Request 'Cancel' function and the
spooled file will exist in a HLD status.
If the command is entered in batch or *PRINT is
specified, the spooled file is output and retained.
Restrictions
------------
See the rules relative to entering an amount.
Prerequisites
-------------
The following TAA Tools must be on your system:
CHKACTOBJ Check active object
CHKDBFMBR Check data base file member
CHKOBJ3 Check object 3
EDTVAR2 Edit variable 2
PMTOPR Prompt operator
RSNLSTMSG Resend last message
RTVDAT Retrieve date
RTVSYSVAL3 Retrieve system value 3
SNDCOMPMSG Send completion message
SNDDIAGMSG Send diagnostic message
SNDESCINF Send escape information
SNDESCMSG Send escape message
SNDSTSMSG Send status message
TAAARC TAA archive
Implementation
--------------
None, the tool is ready to use.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CRTCALC *CMD TAACLCC QATTCMD
DLTCALC *CMD TAACLCC2 QATTCMD
CALC *CMD TAACLCC3 QATTCMD
DSPCALC *CMD TAACLCC4 QATTCMD
TAACLCCC *PGM CLP TAACLCCC QATTCL
TAACLCCC2 *PGM CLP TAACLCCC2 QATTCL
TAACLCCC3 *PGM CLP TAACLCCC3 QATTCL
TAACLCCC4 *PGM CLP TAACLCCC4 QATTCL
TAACLCCC13 *PGM CLP TAACLCCC13 QATTCL
TAACLCCR3 *PGM RPG TAACLCCR3 QATTRPG
TAACLCCR4 *PGM RPG TAACLCCR4 QATTRPG
TAACLCCD *FILE DSPF TAACLCCD QATTDDS
TAACLCCP *FILE PF TAACLCCP QATTDDS
TAACLCCQ *FILE PF TAACLCCQ QATTDDS
The TAACLCCQ file is used to allow a second ODP to be opened by CALC.
Structure
---------
CRTCALC Cmd
TAACLCCC CL pgm
DLTCALC Cmd
TAACLCCC2 CL pgm
CALC Cmd
TAACLCCC3 CL pgm
TAACLCCR3 RPG Pgm
TAACLCCC13 CL Pgm
TAACLCCD Display file
DSPCALC Cmd
TAACLCCC4 CL pgm
TAACLCCR4 RPG Pgm
TAACLCCC13 CL Pgm
|