What are the six levels of entries in logical file?
(i) File level entries (optional): File level entries give the system information of the entire file. You can specify whether the key is same as physical file.
(ii) Record format level entries: Record format level entries give the system information about specific record format in the file. for examples ,for a logical file when a record format is described we can specify the physical file it is based on.
(iii) JOIN Level entries: Join level entries give the system information about PF used in a JOIN LOGICAL FILE. (It is not applicable to NON JOIN LOGICAL FILES).
(iv) Field level entries (optional): The field level entries give the system information about individual fields in the record format.
(v) Key field level entries: The key field level entries give the system information about the key fields of a file. The field names used as key fields are specified.
(vi) Select / Omit level entries: These entire give the system information about which records are to be returned to the program when processing the file. These specifications apply to logical file only.
Explain JDUPSEQ and JDFTVAL.
JDUPSEQ:
This join –level keyword is used to specify the order in which records with duplicate join fields are presented when the JLF is read.
The format for this keyword is:
JDUPSEQ (Sequencing field-name [*DESCEND])This keyword has no effect on the ordering of records with unique keys.
If *DESCEND is not specified then the default is sequencing in ascending order.
JDFTVAL:
When this file-level keyword is used the system provides default values for all for fields when a join to a secondary file does not produce any records.
If this keyword is not specified a record in the primary file for which there is
no corresponding record in the secondary file is skipped.
Explain normalization?It is the process of segregating and decomposing information held within a system into logically grouped, related. Uniquely identifiable entities.
What are various steps accessing data area in CL?
The first create a general data area use the command (CRTDTAARA)
To retrieve values from data area use (RTVDTAARA)
To change this value, use (CHGDTAARA)
To display the current value, use (DSPDTAARA)
To delete a data area use (DLTDTAARA)
Mandatory keywords for subfile
SFL
SFLCTL
SFLSIZ
SFLPAG
SFLDSP
What is a Module?
A module is a non-executable program and it contains one or more procedures. If you have modules without procedure then it means that it is having only one default procedure and in case we can use CALLB. We are creating a RPGLE module by CRTRPGMOD and a CL module by CRTCLMOD commands.
How to the create module?
A module is created as a separate object type (*MODULE). Using the CRTRPGMOD command creates an RPGLE module. A module object cannot be run directly. You must use the CRTPGM command to bind module object into a program object. First option 15 or CRTRPGMOD command to create a module. The CRTPGM command is used to cerate a program from one or more module.
Explain procedure used in RPGLE?
A procedure is a non-executable program. If a module is having more than one procedure then we can give explicitly the procedure name to be called in case of CALLP.
v Defining the prototype:
Prototype will specify the following things
ü Parameter type
ü Sequence of the parameter
ü Return variable and its type
ü It tells the name of the procedure and also the type of the call.
It will avoid all the run time problems like parameter mismatch by specifying the prototype.
v Prototype interface
It is like *entry parameter where we will specify the parameters that are received in this program.
v Import and export
If you want to specify the procedures to be the external programs then we can specify EXPORT in your procedure.
v Global and local variables
If you declare a variable in main procedure then it will be accessible in all sub procedure and this is global declaration and if you specify the declaration in the sub procedures then it will not be accessed in other procedures or in the main procedure.
v Return
If we specify return in the sub procedure then it means that we are returning something to the calling program. We can return a maximum of only one variable to the calling program.
v Recursion
A procedure calling to it self is known as recursion.
v Pass by value/pass by reference
In case of pass by reference we are passing the address of the parameters and not the actual value and so the changes in the called procedure will affect the value in the calling program. In OPM program we are using only call by reference and in RPGLE we have the option to pass the parameter by giving the keyword VALUE.
v CALLP/Expression
We can call the procedure by using CALLP command if it is not having any return type and by an expression if it returns any value.
How you can import and export a data type between 2 programs?
If you are using an export statement when declaring a variable then the data type can be imported in any modules that is bind either by value or by reference. So in this case we can pass values in between modules instead of using PLIST and *ENTRY.
What is the difference in between CALL, CALLB and CALLP?
CALL is a dynamic call where the control will be transferred when the program is executed. (Control will be transfer the another program (run time) so it is dynamic call).
Where as CALLB and CALLP are static calls. A module is a non-executable program and it contains one or more procedures. If you have modules without procedure then it means that it is having only one default procedure and in case we can use CALLB.
A module is having more than one procedure then we can give explicitly the procedure name to be called in case of CALLP out of these three CALLP is the most efficient one. (Using the CALLB, CALLP a program or module is bind in the program so it is static.)
How to create a service program and what are the steps involved in this?
The service program means most commonly used modules are grouped (binding) together to form it is called service program.
A service program is not bound to its caller until activation time
While creating service program we can create a binder program where we can refer the modules (or) procedures (or) even data types to be used by the program. Which is using service program.
Advantages of service programs
They do not take up auxiliary storage space. There is only one copy for all users.
There is only a single copy of the read-only code in main storage for all users in this service programs is the same as a program that you call dynamically.
Each user of the service program has an independent work area.
You can pass parameters to a service programs by using the traditional parameter list (or) by importing and exporting variables.
Service programs can be maintained independently of the programs that use the functions. In most cases, changing a service programs does not cause a program using the function to be changed or re-created.
Disadvantages of service programs
Service programs are less desirable for a function you may or may not need. The reason is that it is slower to call a main program that refer to a service program
What is an activation group?
Activation group is the boundary set for similar programs. Activation group is also a storage space in memory.
CLP has a OVRDBF command and calls a RPGLE program
RPGLE program performs a read operation and the pointer is now in the second program and now call the program 3
RPGLE program that also do a read operation which will read the second record
Since the pointer is in the second position and then return to 2nd program in the above situation when the control transfer from 3rd record since the 2 rd record is already read in program 3. But we need to need the 2nd record according to the logic but this is not possible in any OPM programs. But in RPGLE there is a solution for this problem by giving a common activation group for 1st and 2nd program and have a separate activation group for the 3rd program while creating the program itself and this will avoid all the problem we faced before.
In some situation we want to share between 2 program then we can give the activation group in *job level in which the changes in one program will be affected in another program.
Types of activation group levels:
*New: In this case every time you call the program an new activation group will be created which this case will not be used mostly.
*caller: If we don’t know the type of the program that is calling then we can specify *caller where the activation group will be the same of the program that is calling.
Named activation group: We can give our own named for different activation group.
What are the statements that are affected by activation group?
ü OVRDBF
ü OPNDBF
ü OPNQRYF
ü STRCMTCTL
ü DLTOVR
No comments:
Post a Comment