AS/400 Utilities for Beginners

November 15, 1998


There are very simple AS/400 utilities written on CL/400. May be it will be useful for beginners to understand one of my prefered methods: creating complex program using small bricks of this kind.


How to count total number of records in all members of physical file.

Go to top...
Go to next...

PROGRAM:
V99_CL
DESCRIPTION:
The program counts total number of records in all members of physical file and returns this number as parameter. It is good for use by another CL, RPG and etc. programs.
PARAMETERS:
- INPUT:
- OUTPUT:

How to clear all members in physical file.

Go to top...
Go to next...

PROGRAM:
V98_CL
DESCRIPTION:
The program clears ALL members of physical file. It is also good for use by another CL, RPG and etc. programs.
PARAMETERS:
- INPUT:
- OUTPUT:

How to count total number of index entries in all members of logical file.

Go to top...
Go to next...

PROGRAM:
V97_CL
DESCRIPTION:
The program counts total number of index entries in all members of logical file and returns this number as parameter. It is good for use by another CL, RPG and etc. programs.
PARAMETERS:
- INPUT:
- OUTPUT:

How to do something with each member of physical file.

Go to top...
Go to next...

PROGRAM:
V89_CL
DESCRIPTION:
The program does an action with EACH member of physical file. It summarizes and devolopes an idea of the two previous programs, and is also good for use by another CL, RPG and etc. programs.
PARAMETERS:
- INPUT:
- OUTPUT:

How to do something with each member of logical file.

Go to top...
Go to next...

PROGRAM:
V88_CL
DESCRIPTION:
The program does the same as previous: an action with EACH member but in logical file.
PARAMETERS:
- INPUT:
- OUTPUT:

How to display query report for each member of physical or logical file.

Go to top...

PROGRAM:
VRUNQRYC
Uses mentioned above programs V89_CL and V88_CL, and special program V87_CL that run query for one member.
DESCRIPTION:
As example of using previous program here is simple utility that perform an run query for all members of physical or logical file. The program displays query report for EACH member of file.
To pass to program V87_CL additional specific parameter which not included in its standard parameters list an userspace was used. VRUNQRYC creates an userspace and populates it whit value of additional parameter &RCDSEL, and V87_CL retrieves from the userspace value of this parameter.
PARAMETERS:
- INPUT:
YOU CAN:
Create a command VRUNQRY using CMD source file VRUNQRY:

		CRTCMD CMD(yourlib/VRUNQRY) 
		       PGM(yourlib/VRUNQRYC) 
		       SRCFILE(yourlib/yoursrcfile)

TopList 1