Professional Documents
Culture Documents
where
to locate system objects that the user is requesting.
The Elements of a Library List
Library lists on the i5/OS and OS/400 operating systems consist of the following four components that, when grouped
together, define a job's library list.
1.
2.
The job's System Library list, which lists all the libraries that contain base system objects that i5/OS needs to run a job. By default,
system library list entries are designated in the System part of the library list system value (QSYSLIBL). When i5/OS is building a
user's library list, it always puts the system libraries at the top of the list, and system libraries are the first libraries that the operating
system searches when looking for a job object. Although you can insert additional library names into QSYSLIBL, you should only list
IBM-supplied libraries in QSYSLIBL to avoid any problems with accidentally invoking earlier or incorrect versions of operating
system programs. The system library list will usually contain the QSYS and QSYS2 libraries for system programs and objects; the
QHLPSYS library, which contains help text information for the operating system; and the QUSRSYS library, which is IBM's system
library for user objects.
The job's Product Library list entries designate additional IBM libraries that the system uses to support languages and program objects
that are not contained in the QSYS library. Users cannot add Product Library list entries to a library list; only the operating system can
insert up to two Product Library list entries into the library list when it needs to reference various system program libraries. For
example, when you use the Start PDM command (STRPDM), the operating system will insert the QPDA library into your library list
as a Product Library list entry. When i5/OS is looking for an object, the Product Libraries list (if any entries are included) is always
searched second after the System Library list.
3.
The job's Current Library is the first user library in the library list. The default current library value is defined in the Current Library
parameter (CURLIB) of the signed on user's profile description. The current library value is also used as the default library for
accessed objects that designate *CURLIB as their library value. If no current library is specified for a user, the system will use the
QGPL library as its default. The system searches the Current Library third if it doesn't find the target object in either the System
Library list or in the Product Library list.
4.
The User Library list contains all of your application, data, test, and personal libraries that you want users to access on your system.
By default, it is maintained by an i5 administrator in the User part of the library list system value (QUSRLIBL). The User library list
is the last set of libraries searched on library list calls. As of OS/400 V5R1, IBM increased the size of the User Library List so that you
can designate up to 250 library names in the list. On pre-V5R1 systems, the User Library list could only contain a maximum of 25
libraries.
Taken together, these four components make up the default library list for any job on the system. If you are not
overriding these values with custom values for the user, any job that signs on will automatically be assigned the default
library list values shown above.
A library specified as part of the library list cannot be deleted or renamed when the system is fully operational.
Changes take effect at the start of the next job
QUSRLIBL-25(or 250)-QGPL, QTEMP
QSYSLIBL-15-QSYS, QSYS2, QHLPSYS, QUSRSYS
1. Define library?
A Library is a collection of objects.
Type *LIB that is used to group related object and to find objects by name.
A library is a directory to a group of objects.
The number of objects contained in a library and the number of libraries on
the system are limited only by the amount of storage available.
All libraries are placed in the system library QSYS.
Libraries provide a method for organizing objects.
A library is an open-ended directory.
A library can never become FULL as it has no finite size.
Libraries themselves are objects.
Source physical file is also a file, which has one, or more files included in
it. It is just like a directory and it contains many members. The members are
like a various programs residing in the directory CRTSRCPF is used to create
source physical file.
4. Define physical file?
It is a file, which physically occupies the portion of memory. A physical
file contains one record format and one or more members. Its type PF. By
using CRTPF command to create PF. Maximum number of fields included in a
PF is 8000. Maximum no of key fields included is 120.
Logical file does not occupies any memory space and logical file be
derived from physical file. One or more logical file can be derived from a
single physical file. A logical file can contain up to 32 record formats. It selects
records dynamically. It cannot exist with out a physical file. We can filter the
data with criteria by using select and omit command. CRTLF command is
used to create a LF. It accesses the data by creating access path.
A logical file does not contain any data but provides the VIEWS of the data to
satisfy end-users needs.
There are two types
Non join logical file
Join logical file
6. Difference between physical file and logical file?
Physical file
Logical file
REF: This keyword is used to specify the name of the file from which the
field descriptions are retrieved.
Ex: you can specify whether the key is unique.
(ii). Record format level entries: Record format level entries give the system
information about specific record format in the file. For a PF the record
format name is specified along with an optional text description. (FORMAT,
TEXT)
(i) FORMAT:
This record-level keyword specifies that the record format being define is to
share the field specifications of a previously defined record format. The name
of the record format being defined must be the name of the previously defined
record format.
The format of this keyword is:
FORMAT (LIB-NAME / FILE-NAME)
(ii) TEXT:
This record level keyword is used to supply a text description of the record
format and it is used for documentation purposes only.
The format of this keyword is:
TEXT (description)
(iii) Field level entries: The field names and field lengths are specified along with
and optional text description for each field. (ALIAS, ALWNULL, CCSID,
CHECK, CHKMSGID, CMP, COLHDG, COMP, DATFMT, DATSEP, DFT,
EDTCDE, EDTWRD, REFFLD, REFSHIFT, TEXT, TIMEFMT, TIMESEP,
VALUES, VARLEN)
(iv) Key field level entries: The field names used as key fields are specified.
(DESCEND, SIGNED, ABSVAL, UNSIGNED, ZONE, NOALTSEQ,
DIGIT)
8. 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.
9. 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.
10. What are the different between non-join logical files and join logical files.
Non join logical file
We can able to insert or delete
or update records using nonlogical file.
DFU can be used to display
non-join logical file.
1-32 record format is specified
Commitment control is used
11. How many record formats can have physical & logical file.
********
Edit
Beginning
of
data
0001.00
R RECSEL
PFILE
(SELOMIT)
0002.00
K EMPNO
0003.00
O EMPNAME
CMP (EQ
'SHYAM')
0004.00
S EMPNO
CMP (GT
10001)
****************** End of data ************************
EMPNO
EMPNAME
000001 10,002
SANKA
000002 10,004
SENTH
000003 10,005
SANKA
000004 10,007
SANKA
000005 10,008
SENTH
000006 10,010
SENTH
****** ******** End of report
********
Columns
.
.
.
1
71
Edit
KRAMANAVS/EXAMPLE
SEU==> SELOMIT
FMT PF.
*************** Beginning of data *******************
0001.00
R RECSEL
0002.00
EMPNO
5P 0
0003.00
EMPNAME
20A
0004.00
K EMPNO
****************** End of data ************************
EMPNO
EMPNAME
000001
20
SHYAM
000002
30
RAM
000003
40
TOM
000004
50
RAMESH
000005
60
SHYAM
000006
70
SHYAM
000007
80
TOM
000008
90
TOM
000009
100
VASU
****** ******** End of report
********
Columns
.
.
.
1
71
KRAMANAVS/EXAMPLE
SEU==> SELOMILF1
FMT LF
***************
Beginning
************************
0001.00
R RECSEL
(SELOMIT1)
0002.00
K EMPNO
0003.00
S EMPNO
0004.00
S EMPNAME
('SHYAM')
******************
End
**************************
EMPNO
EMPNAME
000001
20
000002
60
000003
70
000004
80
000005
90
000006
100
****** ********
SHYAM
SHYAM
SHYAM
TOM
TOM
VASU
End of report
EMPNAME
of
data
PFILE
data
********
Columns
.
.
.
1
71
KRAMANAVS/EXAMPLE
SEU==> SELOMILF1
FMT LF.
***************
Beginning
************************
0001.00
R RECSEL
(SELOMIT1)
0002.00
K EMPNO
0003.00
S EMPNO
0004.00
O EMPNO
40)
******************
End
***************************
EMPNO
Edit
Edit
of
data
PFILE
data
000001
50
RAMESH
000002
60
SHYAM
000003
70
SHYAM
000004
80
TOM
000005
90
TOM
000006
100
VASU
****** ******** End of report ********
Columns
.
.
.
1
71
Edit
KRAMANAVS/EXAMPLE
SEU==> SELOMILF1
FMT LF
*************** Beginning of data ****************
0001.00
R RECSEL
PFILE
(SELOMIT1)
0002.00
K EMPNO
0003.00
S EMPNO
CMP (GT 50)
0004.00
S EMPNAME
VALUES
('SHYAM')
0005.00
O EMPNO
RANGE (70
90)
****************** End of data ********************
EMPNO
EMPNAME
000001
20
SHYAM
000002
30
RAM
000003
40
TOM
000004
50
RAMESH
000005
60
SHYAM
000006
70
SHYAM
000007
80
TOM
000008
90
TOM
000009
100
VASU
****** ******** End of report ********
Columns
.
.
.
1
71
Edit
KRAMANAVS/EXAMPLE
SEU==> SELOMILF1
FMT LF
*************** Beginning of data *****************
0001.00
R RECSEL
PFILE
(SELOMIT1)
0002.00
K EMPNO
0003.00
S EMPNO
CMP (GT 50)
0005.00
O EMPNO
RANGE (70
90)
****************** End of data ************************
EMPNO
EMPNAME
000001
20
SHYAM
000002
30
RAM
000003
40
TOM
000004
50
RAMESH
000005
60
SHYAM
000006
70
SHYAM
000007
80
TOM
000008
90
TOM
000009
100
VASU
****** ******** End of report
********
Edit
SEU==> SELJOIN
FMT LF
0001.00
0002.00
0003.00
0004.00
0005.00
0006.00
0007.00
000001
000002
000003
000004
000005
******
EMPID
10,001
10,002
10,003
10,004
10,005
********
EMPNAME
MANAGER
SEBI JOSEPH C.
SHIVARAM
PURUSHOTTAM
GAURAV
SAMEER DIGHE
KING
SHARATA
SAM
PAUL
End of report ********
Columns
.
.
.
KRAMANAVS/EXAMPLE
SEU==> SELJOIN1
FMT LF
0001.00
0002.00
0003.00
0004.00
0005.00
0006.00
0007.00
ANIL
71
Edit
Edit
of
JFILE
0002.00
J
JOIN (1 2)
0003.00
JFLD
(MGRID EMPID)
0004.00
EMPID
JREF (1)
0005.00
MANAGER
RENAME (EMPNAME)
0006.00
JREF (2) COLHDG ('MANAGER')
0007.00
MGRID
JREF (2)
******************
End
of
data
****************************
EMPID
MANAGER
MGRID
000001 10,001
SHIVARAM
90,001
000002 10,002
GAURAV
90,002
000003 10,003
KING
90,003
000004 10,004
SAM
90,004
000005 10,005
ANIL
90,005
****** ******** End of report ********
:CLP
***************
******************************
0001.00 PGM
0002.00 DSPLIBL
Beginning
of
data
0003.00 ENDPGM
******************
*********************************
End
of
data
SETNULL: If we delete a record from the parent file and parent key is
matching some records in a dependent file, the DBMS will set to null the
matching keys in the dependent file.
SETDEFAULT: This is like previous case, but matching occurrences in the
foreign key are set to their default values. The default value for the foreign
key has to match a record in the parent file.
RESTRICT: The DBMS will prevent any attempt to delete records in the
parent file if its key is matching some records in the dependent file.
NO ACTION: This has the same meaning as restrict, but different timing.
When we use *NOACTION and an invalid delete operation is about to take
place, DB2 /400 will delay any error message until the end of the operation
itself, allowing for instance the activation of a before trigger attached to the
PF.
If *restrict is in use, the exception message is sent immediately.
Deleting records in a dependent file is always permitted.
Update rule
RESTRICT: We cannot change the value in a parent key if the old values
are matching some records in the dependent file.
The remaining portion of the record can always be updated.
We cannot update a foreign key in a dependent file if the new value
for the key is not null and does not match any value of the parent key.
NO ACTION: This is same as * restrict but with different timing
considerations. Refer above; where we describe no action delete operations.
Inserts
There is no insert rule to be chosen, but referential integrity prevents any
insert in the dependent file if the new record has no match in the parent file
and its foreign key is not null.
21. How to create a trigger in AS/400?
The trigger is an event to be performing before or after any change to a database.
When a trigger is added to a physical file, three attributes need to be defined.
The first is the event that will cause the trigger to fire. A trigger event can
be an insert, an update, or a delete a record from the file.
The second attribute to define is when to fire the trigger-before or after the
event.
The third attribute to define is the identification of the trigger program to
by run.
We can infer that up to six triggers can be defined for each PF.
For each update, insert, and delete
Two triggers can be defined
PF001
VRAMANA
*AFTER
*UPDATE
PGM001
VRAMANA
*BEFORE *AFTER
*INSERT *DELETE
NAME
*NO
*NO
*YES
*YES
0005.00 C
EVAL
S=G
0006.00 C
OUT
S
0007.00 C
S
DSPLY
0008.00 C
SETON
****************** End of data ***********************************
LR
OUTPUT
DSPLY I LIKE YOU
AUTO NUMBER GENERATION
VRAMANA/TEST
TESTEX19
*************** Beginning of data *******************************
0001.00 DA
S
4S 0
0002.00 C
*DTAARA
DEFINE
DATA2
A
0003.00 C
*LOCK
IN
A
0004.00 C
EVAL
A=A+1
0005.00 C
OUT
A
0006.00 C
A
DSPLY
0007.00 C
SETON
0008.00 C
0009.00 C
0010.00 C
****************** End of data ***********************************
OUTPUT
DSPLY
DSPLY
LR
5
6
ACCESSING LDA:
CHGVAR VAR (%SST (*LDA 3 5)) VALUE(123)
OR
CHGDTAARA DTAARA (*LDA (3 5)) VALUE(123)
CHGVAR VAR(&ROLNO) VALUE( %SST (*LDA 3 5))
OR
RTVDTAARA DTAARA (*LDA (3 5)) RTNVAR (&ROLNO)
GROUP DATA AREA (GDA)
The system creates a group data area when an interactive job becomes a
group job.
Only one group data area can exist for a group.
The group data area is deleted when the last job in the group is ended, or
when the job is no longer part of the group job.
A group data area, which is initially filled with blanks, has a length of 512
and type *CHAR.
The following is true for a group data area
You cannot use the group data area as a substitute for a character
variable on the substring built-in function.
A group data area cannot be refered by jobs outside the group.
You cannot create, delete, or allocate a group data area
No library is associated with a group data area.
Example
CHGDTAARA DTAARA (*GDA) VALUE (DECEMBER 1996)
RTVDTAARA DTAARA (*GDA) RTNVAR (&GRPARA)
PROGRAM INITIALIZATION PARAMETER (PIP) DATA AREA
A PIP data area is created for each pre-started job when the job is started.
The object sub-type of the PDA is different then a regular data area.
The PIP can only be refered to by the special value name *PDA.
The size of the PDA is 2000 bytes but the number of parameter contained
in it is not restricted.
Program level
The MONMSG is specified immediately following the last declare command
in your CL program. You can use as many as 100 program-level MONMSG
commands in a program.
Specific command level
Here the MONMSG command immediately follows a CL command. You can
use as many as 100 commands-level MONMSG commands for a single command.
Monitor message command syntax
MONMSG
MSGID ()
CMPDTA ()
EXEC ()
MSGID-Required
Ex: MSGID (MCH1211)
CMPDTA (Optional)
Ex: MONMSG MSGID (MCH1211) CMPDTA (LIB)
EXEC - -(Optional)
CL command
27 What are the disadvantages of using CL over RPG?
We can able to read only records but we cannot able to write or update or delete
records.
SQLRPG
OPNQRYF is faster
compared to SQLRPG
as It is slower
OVRDBF
FILE (file PF) TOFILE (LIB/ PF) SHARE (*Yes)
If a PF is having 100 records and if we want to override the PF so that
it continues only the specific number of records we are using
OVRDBF
OPNQRYF
FILE (LIB / PF) QRYSLT (EMPNO *EQ *BCAT &A)
If you want to perform any SQL operation we have to declare in
OPNQRYF command only.
In case of OPNQRYF we can perform expression only based on
characters but not on numeric.
*BCAT
If you want to perform any charter expression are using *BCAT
expression which will provide a blanks in between the 2 variables.
%WLDCRD
It is similar to %LIKE in SQL
QRYSLT (EMPNAME *EQ %WLDCRD (S* ))
It will fetch all the records whose empname starts from S.
*CT
It will fetch all the records, which conditions the particular charter.
QRYSLT (EMPNAME *CT S )
%RANGE
It will fetch the records within the specific range
QRYSLT (EMPNO *Eq %RANGE (100 110))
CALL PGM (LIB/NAME) PARM ()
DLTOVR
As we see early the main file logically overridden and after performing
the necessary operation, we have to delete the logical file so that the
main file contains the actual records for this DLTOVR will be used.
DLTOVR FILE (OPNPF)
CLOF
We have to close the file, which has been opened
CLOF OPNID (OPNPF)
You will copy overridden file records using CPYFRMQRYF
CPTFRMQRYF
OEMPNO
OEMPNAME
000001 1,001
RAMANAV
000002 1,002
KUMAR
000003 1,003
SHYAM
000004 1,004
RAMESH
000005 1,005
BALU
000006 1,007
KUMAR
****** ******** End of report
CL program
OADDRESS
SALEM1
TRICHY
SALEM
SALEM
SALEM
JJ
********
ODOB
1,232,002
12,123,000
12,345,000
1,010,100
222
32,938
VRAMANA/CLP
OPNQFILE5
***************
Beginning
of
data
*********************************
0001.00 PGM
0002.00
DCL
VAR(&A) TYPE(*CHAR) LEN(5)
0003.00
DCLF
FILE(VRAMANA/OPNQFILE3) RCDFMT(OPNF3)
0004.00
SNDRCVF
RCDFMT(OPNF3)
0005.00
CHGVAR
VAR(&A) VALUE(&OEMPNO)
0006.00
OVRDBF
FILE(OPENF) SHARE(*YES)
0006.01
OPNQRYF
FILE((VRAMANA/OPENF)) QRYSLT('OEMPNO *EQ' +
0006.02
0006.03
0006.04
0009.00
0010.00
0010.01
0011.00
*BCAT &A)
CPYFRMQRYF FROMOPNID(OPENF) TOFILE(VRAMANA/TEMP) +
MBROPT(*REPLACE) CRTFILE(*YES)
DLTOVR
FILE(OPENF)
CLOF
OPNID(OPENF)
RUNQRY
QRYFILE((VRAMANA/TEMP))
ENDPGM
****************** End of data*********************************
OUTPUT
EMPLOYEE NUMBER: 1001
OEMPNO
OEMPNAME
000001 1,001
RAMANAV
****** ******** End of report
OADDRESS
SALEM1
********
ODOB
1,232,002
41. What are the mandatory parameters for declaring a Data queue?
QUEUE NAME
LIB NAME
LENGTH
DATA
WAIT
42. What will RUNSQLSTM will do?
If we want to execute set of SQL statement then we can write all the
SQL statement to be including with the source.
Type as SQL
Only insert, update and delete and no select is allowed.
Then use STRSQLSTM to execute the program
RUNSQLSTM SRCFILE (LIB/TEST) SRCMBR (SQL01) COMMIT
(*NONE)
43. What is a field reference file?
This is PF, which does not have any data and contains only the field
descriptions and these fields are referred in other PF by using REF and
REFFLD
EPM
Extended program
model will support
C,
PASCAL,
FORTRAN
and
another
programming
concepts.
RPGLE
It supports mixed
program support in
which you can
combine
any
program
with
another type of
program.
it
supports
modularity, copy
book, better call
supported.
Version is V1R2
performance.
Version is V2R3
fully integrated into the operating system and machine. The user
communication with all these functions through a single control language
Layered machine architecture
Object orientation
Single-level storage
Hierarchy of microprocessors
Security levels
Layered machine architecture
This insulates users from hardware characteristics. It enables
them to move to new hardware technology at any time, without
disrupting their application programs. We can able to change any
layer without affecting the other layer. If any problem occurs in OS,
then we can work with application program independently and this is
the major advantage of AS/400 system.
Object orientation
Every that can be stored or retrieved on the system is known as
an objects. Objects exist to make users independent of the internal
structure of the machine.
Single- level storage
It provides contiguous memory between main storage and disk
storage. It provides authority to add any disk space so that use. Can
access it without any problem. There is no need for the user to think
where to store the application program.
Hierarchy of microprocessors
Various types of microprocessors are used in AS/400. Each and
every microprocessor is allocated for specific purpose. If one chip is
for input operation and other for output then we can do both input
and output operation since both the microprocessor can perform
independently.
Security levels
It will list the various security provided by the system.
No security
Password security
Resource security
OS security
Certifiable security
49. What are the various types of Security in AS/400?
AS/400 is designed for business that requires levels of security
ranging from nothing at all to full government certifiable security. By
setting a system value, we can configure five increasing level of security.
No security
Password security
Resource security
OS security
Certifiable security
When as AS/400 is configured, three system values dealing with security
need to be specified. These values are QAUDJRL, QMAXSIGN &
QSECURITY.
QSECURITY:
This system value determines the level of security enforcement. S/38
and the original AS/400 only had three of system security. At VIR3 of
OS/400 the fourth level of security was added, and the fifth level of
security was added at V2R3. The valid values for QSECURITY are
10,20,30,40,50.
QMAXSIGN:
This system value determines the maximum number of signon
attempts allowed. If the number of unsuccessful attempts to signon to the
system exceeds this number, the terminal or device that attempted the
signon is varied off.
QAUDJRL:
AS/400 supports an optional security auditing function. If this
function is specified, certain security events are journal. The specific
events that are logged in the security audit journal are determined by the
value specified in the QAUDJRL system value and the level of system
security specified.
Level 10: No security
System is shipped with minimum-security level and doesnt
require any password to signon. If user profile doesnt exists with the
same name as the
Userid the system creates the user profile with that name.
Level 20:Password security
Minimum security is active and password is required to signon.
The user profile must already exist for the user before we can signon the
system
Level 30:Resource security
Password security is active and user must specify given
authority to resources. This level is recommended because the system
doesnt give the user authority to access the entire object on the system
after the user signon.
User (*USER)
Authorization of objects
Object authority, or the right to user to use or control an object comes
in two categories.
Object rights
Data rights
Object rights
Object rights are concerned with the object itself.
Object rights assign a user the following authority
Operational rights (*OPER)
Object management rights (*OBJMGT)
Object existence rights (*OBJEXT)
Operational right (*OPER)
The authority to use an object, looks at its description, and
restores it. A user must have operational rights to a program to
execute it.
Object management rights (*OBJMGT)
The authority to grant and revoke and user rights move and
rename object, and members to database file.
Object existence rights (*OBJEXT)
The authority to delete, free storage, save restore or transfer
ownership of an object.
Data rights
Data rights apply to the data contained within the object.
Types of data rights
Read (*READ)
The authority to retrieve the contents of an object entry.
Add (*ADD)
The authority to add entries to an object. For example adding
records to a database file requires ADD rights for the library.
Update (*UPD)
The authority to change the entries in an object requires UPD
rights for the file.
Delete (*DLT)
The authority to remove object in an object. For example
deleting a program from a library requires DLT rights for the library.
Deleting records for a database the requires DLT rights the database
file.
51. What are the various ways creating access path?
Access path means the records are to be retrieved from a file. The records
can be retrieved from a PF or a LF either ARRIVAL SEQUENCE or by
KETED SEQUENCE. For LF you can also select records using select or omit
keywords
Arrival sequence access path
Sequentially, where each record is taken from the next sequential
physical position in the file.
Directly by relative records number, where the record number is
identified by its position from the start of the file.
CALL
TFRCTL
***************
Beginning
********************************
0000.01 d*date function using the adddur
0001.00 DTIMESTE
S
Z
0001.01 DTIME5
S
Z
0002.00 DDATE1
S
D
0002.01 DDATE2
S
D
0002.02 DDATE3
S
D
0002.03 DDATE4
S
D
0003.00 DTIME1
S
T
0003.01 DTIME2
S
T
0003.02 DTIME3
S
T
0003.03 DTIME4
S
T
0004.00 C
MOVEL
*DATE
0005.00 C
DATE1
ADDDUR
02:*Y
0006.00 C
DATE1
ADDDUR
05:*M
0007.00 C
DATE1
ADDDUR
01:*D
0007.01 C
TIME
0007.02 C
TIME
0008.00 C
TIME1
ADDDUR
10:*H
0009.00 C*
TIME1
ADDDUR
10:*ML
0010.00 C
TIME1
ADDDUR
10:*S
0011.00 C
TIMESTE
ADDDUR
10:*MS
0012.00 C
DATE2
DSPLY
0013.00 C
DATE3
DSPLY
0014.00 C
DATE4
DSPLY
0014.01 C
TIME1
DSPLY
0014.02 C
TIME2
DSPLY
0014.03 C
TIME3
DSPLY
0014.04 C
TIME4
DSPLY
0014.05 C
TIME5
DSPLY
0015.00
C
LR
******************
End
*********************************
OUTPUT
DSPLY 2004-06-27
DSPLY 2002-11-27
DSPLY 2002-06-28
DSPLY 12.18.36
DSPLY 22.18.36
DSPLY 00.00.00
DSPLY 12.18.46
DSPLY 2002-06-27-12.18.36.953010
SUBDUR:
of
data
DATE1
DATE2
DATE3
DATE4
TIME1
TIMESTE
TIME2
TIME3
TIME4
TIME5
SETON
of
data
It is used to find the difference between two date (or) time (or) time stamp
Example
VRAMANA/DATE
SUBDUR
***************
Beginning
********************************
0000.01 d*date function using the SUBDUR
0001.00 DTIMESTE
S
Z
0001.01 DTIME5
S
Z
0002.00 DDATE1
S
20')
0002.01 DDATE2
S
D
0002.02 DDATE3
S
D
0002.03 DDATE4
S
D
0003.00 DTIME2
S
T
0003.01 DTIME1
S
T
0003.02 DTIME3
S
T
0003.03 DTIME4
S
T
0005.00 C
DATE1
SUBDUR
02:*D
0006.00 C
DATE1
SUBDUR
05:*M
0007.00 C
DATE1
SUBDUR
01:*Y
0007.01 C
TIME
0008.00 C
TIME2
SUBDUR
10:*H
0010.00 C
TIME2
SUBDUR
10:*S
0012.00 C
DATE2
DSPLY
0013.00 C
DATE3
DSPLY
0014.00 C
DATE4
DSPLY
0014.01 C
TIME1
DSPLY
0014.02 C
TIME2
DSPLY
0014.03 C
TIME3
DSPLY
0014.04 C
TIME4
DSPLY
0015.00
C
LR
******************
End
***********************************
OUT PUT
DSPLY 1977-06-18
DSPLY 1977-01-20
DSPLY 1976-06-20
DSPLY 02.50.10
DSPLY 12.50.10
DSPLY 00.00.00
DSPLY 12.50.00
of
data
INZ (D'1977-06-
DATE2
DATE3
DATE4
TIME1
TIME1
TIME4
SETON
of
data
EXTRCT:
It is used to extract year, month, day, hours, minutes, seconds, and
microseconds of a time stamp or date field.
Example:
VRAMANA/DATE
EXRCT
***************
Beginning
of
data
********************************
0000.01 d*FINT THE EXRCT DAY MONTH YEAR
0001.00 DTIMESTE
S
Z
0002.00 DDATE1
S
D
INZ (D'1977-0620')
0002.01 DDATE3
S
D
0002.02 DDATE2
S
5P 0
0002.04 DDATE4
S
5P 0
0002.05 DDATE5
S
5P 0
0002.06 DDATE6
S
5P 0
0002.07 DDATE7
S
5P 0
0002.08 DDATE8
S
5P 0
0003.00 DTIME0
S
T
INZ (T'12. 50.10)
0003.01 DTIME1
S
T
0003.02 DTIME2
S
5P 0
0003.03 DTIME4
S
5P 0
0003.04 DTIME5
S
5P 0
0003.05 DTIME6
S
5P 0
0003.06 DTIME3
S
26P 0
0004.00 C
MOVEL
*DATE
DATE3
0004.01 C
TIME
TIME1
0004.02 C
TIME
TIMESTE
0005.00 C
EXTRCT
DATE1:*M
DATE2
0006.00 C
EXTRCT
DATE3:*M
DATE4
0007.00 C
EXTRCT
DATE1:*D
DATE5
0007.01 C
EXTRCT
DATE3:*D
DATE6
0007.02 C
EXTRCT
DATE1:*Y
DATE7
0007.03 C
EXTRCT
DATE3:*Y
DATE8
0007.04 C
EXTRCT
TIME1:*H
TIME2
0007.05 C
EXTRCT
TIME1:*H
TIME4
0007.06 C
EXTRCT
TIME0:*H
TIME5
0007.07 C
EXTRCT
TIME0:*S
TIME6
0011.00 C
EXTRCT
TIMESTE:*MS
TIME3
0012.00 C
DATE2
DSPLY
0013.00 C
DATE8
DSPLY
0013.01 C
DATE4
DSPLY
0013.02 C
DATE5
DSPLY
0013.03 C
DATE6
DSPLY
0014.00
0014.01
0014.02
0014.03
0014.04
0014.05
0015.00
LR
C
C
C
C
C
C
OUTPUT
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DATE7
TIME2
TIME4
TIME5
TIME6
TIME3
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
SETON
6
2002
6
20
27
1977
12
12
12
10
441000
TEST:
Test is the most powerful opcode, which will check a date is a valid, or not .The
low level indicator is set on if the date is not valid or set off if the date is a valid one.
Test will be given with extended factor like test (d), test (t), test (z) for date, time
and time stamp and if test without extended factor default to date (z).
Example
VRAMANA/DATE
TEST
***************
Beginning
of
data
*********************************
0000.01 C*TEST FOR VALID DATE THE DATE VALID SETOFF OR SETON
(NOTVALID)
0001.00 C
MOVEL
'13/03/1999 A
10
0002.00 C
TEST (D)
A
30
0003.00 C
*IN30
DSPLY
0003.01 C
IF
*IN30=*ON
0003.02 C
'NOTVAILD'
DSPLY
0003.03 C
ELSE
0003.04 C
'VALID'
DSPLY
0003.05 C
ENDIF
0004.00
C
SETON
LR
******************
End
***********************************
OUTPUT
DSPLY 1
DSPLY NOTVAILD
of
data
0001.00
0002.00
0003.00
0004.00
0005.00
0006.00
0007.00
0008.00
0009.00
0010.00
0011.00
darr1
di
c
i
c
arr1(i)
c
c
c
4
s
do
dsply
add
enddo
seton
3
1
**
1001
20
1000
****************** End of data ********************************
OUTPUT
DSPLY 1001
DSPLY 20
DSPLY 1000
VRAMANA/ARRAY
RUNTIME
*************** Beginning of data *****************************
c*runtime array
darr1
s
10
dim(12)
di
s
2p 0 inz(1)
da
s
3p 0
dj
s
2p 0 inz(1)
c
i
do
12
c
dsply
arr1(i)
c*
eval
arr1(i)=a
c
add
1
i
c
enddo
c
j
do
12
c
arr1(j)
dsply
c
add
1
j
c
enddo
c
seton
lr
****************** End of data *********************************
0000.01
0001.00
0002.00
0002.01
0002.02
0003.00
0004.00
0005.00
0006.00
0006.01
0006.02
0006.03
0006.04
0006.05
0006.06
0006.07
0006.08
0006.09
0006.10
0006.11
0006.12
0006.13
0007.00
0008.00
0009.00
0010.00
0011.00
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
c
else
c
'notfou'
dsply
c
endif
c
d
dsply
c
j
do
3
c
arr1(j)
dsply
c
add
1
j
c
enddo
c
seton
lr
**
1001
2000
1000
****************** End of data ***********************************
1001
2000
1000
found
4001
1000
1001
2000
0005.02
0007.00
0007.01
0010.00
0011.00
0012.00
0013.00
0014.00
0015.00
0016.00
0017.00
0018.00
0019.00
0020.00
0021.00
DRES
S
2S 0
C
Z-ADD
1
NUM1
2 0
C
Z-ADD
0
NUM2
2 0
C
EVAL
RES=NUM1/NUM2
C
'NOTCOM'
DSPLY
C
A
TAG
C
'COMING'
DSPLY
C
SETON
LR
C
*PSSR
BEGSR
C
STATUS
DSPLY
C
ROUTINE
DSPLY
C
PARMS
DSPLY
C
DUMP
C
GOTO
A
C
ENDSR
****************** End of data ******************************
Output
DSPLY
102
DSPLY *DETC
DSPLY
0
DSPLY COMING
General keywords
SFLDSP
-> subfile display
SFLDSPCTL
-> subfile display control
SFLCLR
-> subfile clear
SFLEND
-> subfile end
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . :
SENWLT1
Keyword
. . .
SFLCTL
SENWND1
. . .
SFLCSRRRN
. . .
SFLMODE
Y=Yes
. . .
SFLDSP
Y
. . .
SFLDSPCTL
Y
. . .
SFLINZ
. . .
SFLDLT
. . .
SFLCLR
. . .
SFLEND
. . .
*MORE
Y
. . .
*SCRBAR
. . .
SFLRNA
Name
Name
Name
Indicators/+
25
26
28
30
*MORE ...
More...
F3=Exit
F12=Cancel
This keyword is used to insert the system that the subfile records
format has to be displayed. The subfile record format without any record
in it cannot be displayed.
Subfile Display control (SFLDSPCTL)
This keyword is used to instruct the system that the subfile control
record format has to be displayed.
0009.00 C N30
SETON
2526
SETON
WRITE SENWLT1
SETOFF
28
28
This has to be associated with the subfile record format in the F spec
continuation line.
This has to be declared in the program as numeric variable of
maximum length 4 and decimal position 0.
F spec format in continuation line with SFILE option
0002.00 FSENDESFILECF E
WORKSTN
0003.00 F
SFILE (SFL01:RRN1 )
Where RRN1 -> RRN variable name
SFL01-> subfile record format name.
RPGLE Opcodes
EXFMT
If SFLDSP and SFLDSPCTL indicators are on, this opcode will
send the two subfile record formats to the display device and waits
for the users response.
WRITE (SFL)
This opcode is used to add a record to the subfile record
format
RRN value should be set with a non-existing value before
adding the record in the subfile record format.
WRITE (SFLCTL)
This keyword is used for clearing & display the subfile
SFLDROP (subfile drop)
This record level keyword is used to assign a CA (command
attention) or CF (command function) key. The program first displays the
subfile in truncated form; subfile records are truncated to fit on one
display line. When the user presses the specified key, the program displays
the records in the folded form.
Or
Subfile Initially Truncated - Help Type a command function (CF) or
command attention (CA) key number to assign a CF or CA key to specify
if a subfile control record requiring more than one display line should be
truncated to one line, or should be folded to display on two lines. When
this keyword is specified, the subfile is first displayed in truncated form.
EMPNOM
EMPNA
SEX3 AGE3
ADDRESS5
000001
101
K.RAMANAVKUMAR
M
25
ATTUR
000002
102
R.SHYAMSUNDAR
M
27
TRICHY
000003
103
B.MOHAN
M
27
TCODE
000004
104
K.KUMAR
M
25
SALEM
000005
105
A.ARUL
M
25
SALEM
000006
106
BALU
M
25
SALEM
000007
107
RAMANAV
M
35
SALEM
000008
108
RAJ
M
22
TCODWE
000009
109
HEMA
M
33
SALEM
000010
110
VEL
M
67
SALEM
000011
111
RAMESH
M
56
ATTUR
000012
122
SUDHA
M
28
SALEM
000013
123
KANDASAMY
M
34
SALEM
****** ******** End of report ********
VRAMANA/SUBFILE
SUB04
CITY5
SALEM
TRICHY
SALEM
SALEM
NAMAKKAL
SALEM
TRICHY
SALEM
CHENNAI
SALEM
SALEM
ATTUR
ATTUR
0002.00
0015.00
0016.00
0016.01
0016.02
0016.03
0017.00
0018.00
0019.00
0001.00
0002.00
0003.00
0004.00
0005.00
0006.00
0007.00
0008.00
0009.00
0010.00
0011.00
0012.00
0013.00
0014.00
0015.00
0016.00
0016.01
0016.02
0016.03
0016.04
0020.00
0021.00
Y=Yes
Y
Y
Keyword
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
INZRCD
KEEP
ASSUME
ALWROL
RETKEY
Y=Yes
RETCMDKEY
CHGINPDFT
MNUBARDSP
ENTFLDATR
RTNCSRLOC
Roll
Y
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Keyword
RTNCSRLOC
Y=Yes
Y=Yes
Name
Name
Name
Y
Y
RECSD
EMPCUR
TAKE 12 AND F4
Work with Fields
Record . . . :
MAIN1
Type information, press Enter.
Number of fields to roll . . . . . . . . . . . . . . . . . .
6
Type options, change values, press Enter.
1=Select keywords
4=Delete field
Option
Order
Field
Type Use Length Row/Col Ref Condition
70
AGE
C
21
15 014
80
RECSD
A
H
10
90
EMPCUR
A
H
10
100
---------C
76
21 003
110
F3->EXIT
C
37
22 005
120
EMPNOM
S
B
6,0
09 036
Y
Overlap
More...
Add
Add
Add
H
M
P
Hidden
Message
Program-to-system
TEKE 12
SENWLT1
Select Window Keywords
Window record . . . . . . . . . . . . . :
SENWLT1
Type choices, press Enter.
Y=Yes
General keywords . . . . . . . .
Y
Select record keywords . . . . .
Y
General SFLCTL keywords . . . . .
Y
Subfile display layout . . . . .
Y
Subfile messages . . . . . . . .
Y
Select General Keywords
Window record . . . . . . . . . . . . . :
SENWLT1
Type choices, press Enter.
Keyword
Window parameters . . . . . . . . . . . .
WINDOW
Y=Yes
Y
Indicators/+
Select parameters . . . . . . . . . . .
Window borders . . . . . . . . . . . . . .
WDWBORDER
Select parameters . . . . . . . . . . .
Remove windows . . . . . . . . . . . . . .
RMVWDW
User Restore Display . . . . . . . . . . .
USRRSTDSP
Define Window Parameters
Record . . . :
SENWLT1
Keyword . . :
WINDOW
Referenced window . . . . . . . . . . . .
-ORWindow definition
Default start positioning . . . . . . .
-ORStart line
Program-to-system field . . . . . . .
Actual line . . . . . . . . . . . . .
2
Start position
Program-to-system field . . . . . . .
Actual position . . . . . . . . . . .
2
Window lines . . . . . . . . . . . . . .
20
Window position . . . . . . . . . . . .
40
Message line . . . . . . . . . . . . . .
Y
Restrict cursor to window . . . . . . .
Y
Select Record Keywords
Record . . . :
SENWLT1
Type choices, press Enter.
Y=Yes
General keywords . . . . . . . .
Y
Indicator keywords . . . . . . .
Y
Application help . . . . . . . .
Help keywords . . . . . . . . . .
Output keywords . . . . . . . . .
CF12
CF03
Name
Y=Yes
Name
1-25
Name
1-128
1-25
1-128
Y=Yes
Y=Yes
12
03
Name
Name
Name
Indicators/+
25
26
28
30
*MORE ...
More...
F3=Exit
F12=Cancel
EMPLOYEE DETAILS:
1.SELECT
OPT
EMPNUMBER
000106
000107
000108
000109
000110
NAME
BALU
RAMANAV
RAJ
HEMA
VEL
More...
EMPLOYEE DETAILS
1.SELECT
OPT
EMPNUMBER
NAME
000111
RAMESH
000122
SUDHA
000123
KANDASAMY
*************** Beginning
C
CALLB
C
CALLB
C
CALLB
C
SETON
****************** End of
VRAMANA/RPGILE
MAIN
of data *******************************
'ADD'
'SUB'
'MUL'
LR
data **********************************
VRAMANA/RPGILE
ADD
of data *******************************
4
A
4 0
5
B
4 0
B
C
4 0
*************** Beginning
0002.00 C
Z-ADD
0002.01 C
Z-ADD
0004.00 C
A
ADD
0005.00 C
C
DSPLY
0006.00 C
SETON
LR
****************** End of data *********************************
VRAMANA/RPGILE
SUB
*************** Beginning of data *******************************
002.00 C
Z-ADD
10
A
4 0
002.01 C
Z-ADD
5
B
4 0
004.00 C
A
SUB
B
C
4 0
005.00 C
C
DSPLY
006.00 C
SETON
LR
****************** End of data *********************************
VRAMANA/RPGILE
MUL
*************** Beginning of data ******************************
0002.00 C
Z-ADD
10
A
4 0
0002.01 C
Z-ADD
5
B
4 0
0004.00 C
A
MULT
B
C
4 0
0005.00 C
C
DSPLY
0006.00 C
SETON
LR
****************** End of data *********************************
CRTPGM Take F4
Program . . . . . . . . . . . . > MAIN
Name
Library . . . . . . . . . . . >
VRAMANA Name, *CURLIB
Module . . . . . . . . . . . . . > MAIN
Name, generic*, *PGM, *ALL
(PEP)
Library . . . . . . . . . . . >
VRAMANA Name, *LIBL, *CURLIB...
> ADD
>
VRAMANA
> SUB
>
VRAMANA
+ for more values > MUL
>
Text 'description' . . . . . . .
OUTPUT
DSPLY
DSPLY
DSPLY
VRAMANA
*ENTMODTXT
9
5
50
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 programs. In OPM programs we are using only call by reference.
Pass by value:
Pass by value we are passing the value of the parameter, changes made to the
formal arguments in the called function have no effect on the values of the actual
arguments in the calling function it is used in c program.
In RPGLE we have the option to pass the parameter by value by giving the
keyword VALUE.
72. What are Program Entry Procedure (PEP) and User Entry Procedure (UEP)?
If we are binding many modules together to form a program then we have to specify
which module has to take control first when it has been called and that module is called
as PEP for that program.
User entry procedure (UEP) is the first statement that takes the control when a
program has been called. For example in C programs main () will be executed first when
it has been called and like wise in RPG the statement coded in C Spe will take the control
first.
73. Define Copybook in RPGLE?
It will copy a Subroutine (or) any group of codes physically into the program,
which is copying it.
VRAMANA/RPGILE
0002.00
0002.01
0004.00
0005.00
0000.01
0001.00
0002.00
0003.00
0004.00
OUTPUT
13
DSPLY
COP
*************** Beginning of data ******************************
C
DSPLY
A
5 0
C
EXSR
ADD
C
SETON
LR
C/COPY RPGILE, COPY
****************** End of data ********************************
VRAMANA/RPGILE
COPY
*************** Beginning of data ******************************
C
ADD
BEGSR
C
ADD
5
A
C
A
DSPLY
C
ENDSR
****************** End of data *******************************
18
***************
Beginning
of
*****************************
0001.00 di
s
5p 0 inz(1)
0002.00 dn
s
5p 0 inz(10)
0003.00 c
for
i=1 to n
0004.00 c
i
dsply
0005.00 c
endfor
0006.00 c
for
i=n downto 1
0007.00 c
i
dsply
0008.00 c
endfor
0008.01 * for(I=5;I<40;i=i+10)
0009.00 c
for
i=5 by n to 40
0010.00 c
i
dsply
0011.00 c
endfor
0012.00 c
for
i=5 to 40 by n
0013.00 c
i
dsply
0014.00 c
endfor
0015.00
c
lr
******************
End
of
*****************************
OUTPUT
DSPLY 1
DSPLY
10
DSPLY 2 DSPLY
9
DSPLY 3 DSPLY
8
DSPLY 4 DSPLY
7
DSPLY 5 DSPLY
6
DSPLY 6 DSPLY
5
DSPLY 7 DSPLY
4
DSPLY 8 DSPLY
3
DSPLY 9 DSPLY
2
DSPLY 10 DSPLY
1
DSPLY 5 DSPLY
5
DSPLY 15 DSPLY
15
DSPLY 25 DSPLY
25
DSPLY 35 DSPLY
35
data
seton
data
75. What are the various stages for a job after it is submitted?
Job queue, Active job, ant OUTQ is the three stages after the job has been
submitted.
76. What is the equivalent command to setll *loval in CL?
POSDBF with file position as *start will set the file to the beginning (or) using
OVRDBF and specify the key field value by RRN value (or) by giving *start.
77. 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.
*caller: If we dont 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.
79.What are the statements that are affected by activation group?
OVRDBF
OPNDBF
OPNQRYF
STRCMTCTL
DLTOVR
80. What are the statements, which is not used in CLLE that is used in CLP?
RCLRSC which is replaced by RCLACTGRP
TFRCTL
81. What is the difference between FMTDTA and OPNARYF?
FMTDTA
OPNQRY
84. Explain inner join or natural join and left outer join?
Inner join
Inner join means the matching records in between the joining file will be
selected.
Columns . . . 1 71
Edit
KRAMANAVS/EXAMPLE
SEU==> JPF01
FMT PF
*************** Beginning of data ****************************
0001.00
R JP1REC
0002.00
EMPNO
5S 0
0003.00
EMPNAME
20A
0004.00
K EMPNO
****************** End of data *****************************
Columns . . . 1 71
Edit
KRAMANAVS/EXAMPLE
SEU==> JPF02
FMT PF.
*************** Beginning of data ***************************
0001.00
R JP2REC
0002.00
EMPNO
5S 0
0003.00
EMPSAL
10P 2
0004.00
K EMPNO
****************** End of data ********************************
Display Report
EMPNO
EMPNAME
000001 1,001
SHYAMBABU
000002 1,002
RAMANAVKUMAR
000003 1,003
RAMESH
****** ******** End of report ********
EMPNO
EMPSAL
000001 1,001
100.00
000002 1,002
20.00
000003 1,004
300.00
****** ******** End of report ********
Columns . . . 1 71
Edit
KRAMANAVS/EXAMPLE
SEU==> JOFILE
FMT LF.
*************** Beginning of data ************************
0001.00
R JREC1
JFILE (JPF01 JPF02)
0002.00
J
JOIN (1 2)
0003.00
JFLD (EMPNO EMPNO)
0004.00
EMPNO
JREF (JPF01)
0005.00
EMPNAME
0006.00
EMPSAL
0007.00
K EMPNO
****************** End of data*********************
EMPNO
EMPNAME
000001 1,001
SHYAMBABU
000002 1,002
RAMANAVKUMAR
****** ******** End of report
EMPSAL
100.00
20.00
********
EMPNO
EMPNAME
000001 1,001
SHYAMBABU
000002 1,002
RAMANAVKUMAR
000003 1,003
RAMESH
****** ******** End of report
EMPSAL
100.00
20.00
.00
********
000001
000002
000003
******
EMPNO
10,001
10,002
10,003
********
EMPNAME1
BOB
DANNY
PRINC
End of report
EMPNO
EMPNAME
000001 10,001
BOB
000002 10,001
BOB
000003 10,001
BOB
ADDRESS
23,OLD MADIWALA
50,LONG ISLAND
90,ATTUR
********
TEL
825,777
825,999
825,888
000004
******
Columns
SEU==>
FMT LF
0001.00
0002.00
0003.00
0004.00
0005.00
0006.00
0007.00
0008.00
000001
000002
000003
000004
******
10,002
DANNY
******** End of report ********
. . . 1 71
Edit
JDFTSEQ
4,222,600
KRAMANAVS/EXAMPLE
JOIN DESCEND
Columns . . . 1 71
Edit
KRAMANAVS/EXAMPLE
SEU==> JDFTSEQ
FMT LF
*************** Beginning of data ***********************
0001.00
R RECSEQ
JFILE (SEQ1 SEQ2)
0002.00
J
JOIN (1 2)
0003.00
JFLD (EMPNAME1 EMPNAME)
0004.00
JDUPSEQ (TEL *DESCEND)
0005.00
EMPNO
JREF (2)
0006.00
EMPNAME1
0007.00
ADDRESS
0008.00
TEL
****************** End of data *************************
EMPNO
EMPNAME1
ADDRESS
TEL
000001 10,001
BOB
23,OLD MADIWALA
825,999
000002 10,001
BOB
23,OLD MADIWALA
825,888
000003 10,001
BOB
23,OLD MADIWALA
825,777
000004 10,002
DANNY
50,LONG ISLAND
4,222,600
****** ******** End of report ********
0000.01
0001.00
0002.00
0003.00
0004.00
0005.00
VRAMANA/BULID
REPLACE
*************** Beginning of data ****************************
d*replace the string using keyword %replace
dc
s
16a
inz('RAMANAVRaman')
db
s
20a
c
eval
b=%replace('Ram':c:4:3)
c
b
dsply
c
seton
lr
****************** End of data *****************************
OUTPUT
DSPLY RamRamvRaman
The use of the TRIM functions is very limited, in that they support
only the use of character variables and data structures. Numeric fields,
and zero-fill values are not supported. They do, however, provide some
useful function for string handling. For example, in RPG IV, one line
of code is all that's needed to left-adjust a value within a field. For
example:
CCRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHiL
oEq
ExFmtCustMaint
C
C
Eval
CustName=%TrimL(CustName)
Typically, the %TRIM function is the only one of the three that get
used. The other two, however, do have their place.
%TRIM removes trailing and leading blanks from a field, and
returns the remaining value, in place, within the expression. The
returned value is treated similar to a constant value with leading or
trailing blanks.
%TRIML removes leading blanks (trim-left) from a field, and
returns the value in place, within the expression.
%TRIMR removes trailing blanks (trim-right) from a field, and
returns the value in place, within the expression.
%FOUND, %EOF, %EQUAL,%OPEN
ELEM
*************** Beginning of data ******************************
darr1
s
3s 0 dim(100)
dc
s
3s 0
c
eval
c=%elem(arr1)
c
c
dsply
c
seton
lr
****************** End of data **********************************
OUTPUT
DSPLY 100
%SIZE
%SIZE will display the size of the variable
VRAMANA/BULID
SIZE
*************** Beginning of data *****************************
0000.01 D*BY USING THIS COMMAND FIND SIZE OF DATA VALUE
0001.00
0002.00
0003.00
0004.00
0005.00
0006.00
0007.00
0008.00
0009.00
0010.00
0011.00
0012.00
0013.00
0014.00
0015.00
0016.00
0017.00
0018.00
0019.00
darr1
s
10p 0 dim(10)
dds1
s
10p 0 dim(20)
dnum
s
20p 0
c
z-add
2
a
20 0
c
movel
'RAMANAV'
b
10
c
eval
num=%size(a)
c
c
num
dsply
c
eval
num=%size(b)
c
num
dsply
c
eval
num=%size(arr1)
c
num
dsply
c
eval
num=%size(arr1:*all)
c
num
dsply
c
eval
num=%size(ds1)
c
num
dsply
c
eval
num=%size(ds1:*all)
c
num
dsply
c
seton
lr
****************** End of data **********************************
OUTPUT
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
DSPLY
6
11
10
6
60
6
120
%EDITW
86.Explain keyword in ILE?
Overlay
Rename
Prefix
Options
Const
87.How you can schedule a job to run periodically?
We have to create a job scheduler for running a job periodically. Here we can
make a job to run once or periodically at a given date and time. We can create a job
scheduler by using ADDJOBSCDE command.
We can list all the job scheduler running by using the command
WRKJOBSCDE command and we can delete a job scheduler by using
RMVJOBSCDE or we can reschedule the job by using CHGJOBSCDE.
88.How to debug a batch job?
OPTION 12
Add Message Description (ADDMSGD)
Type choices, press Enter.
Message identifier . . . . .
Message file . . . . . . . .
Library . . . . . . . . .
First-level message text . .
PAGE DOWN
Message data fields formats:
Data type . . . . . . . .
Length . . . . . . . . . .
WRKMSGF
MKS0001
MKS0002
MKS0003
MKS0004
MKS0005
MKS0006
MKS0007
MKS0008
MKS0009
MKS0010
0
0
0
0
0
0
0
0
0
0
.
.
.
.
.
.
.
.
MKS0001
Name
> MKSFILE
Name
>
VRAMANA
Name, *LIBL, *CURLIB
EMPLOYEE NUMBER &1 CANNOT BE ZEROS
. .
. .
*CHAR
10
MSGREC1
20
MSGCTL1
USING 8 SELETION
SFLMSG
SFLCTL
MSGREC1
06/27/02
06/27/02
24
1-27
Message ID field . . . . .
(if program message queue
one message at a time)
Program message queue field
Generate a 276 byte field
MESSAGE SUBFILE (SFTCTL)
Subfile control record . . . .
Type choices, press Enter.
. . . . .
is built
SFLMSGKEY
DUMMY
Name
. . . . .
. . . . .
SFLPGMQ
QUEUE
Name
Y=Yes
. . . . . :
MSGCTL1
Y=Yes
. . . .
Y
. . . .
Y
. . . .
Y
. . . .
Y
. . . .
Define General Keywords
Subfile control record . . . . . . . . . :
MSGCTL1
Type choices, press Enter.
Keyword
Related subfile record . . . . . . .
SFLCTL
MSGREC1
Subfile cursor relative record . . .
SFLCSRRRN
Subfile mode . . . . . . . . . . . .
SFLMODE
Program message queue field . . . .
SFLPGMQ
QUEUE
Generate a 276 byte field . . . .
Y=Yes
Display subfile records . . . . . .
SFLDSP
Y
Display control record . . . . . . .
SFLDSPCTL
Y
Initialize subfile fields . . . . .
SFLINZ
Y
Delete subfile area . . . . . . . .
SFLDLT
Clear subfile records . . . . . . .
SFLCLR
Indicate more records . . . . . . .
SFLEND
SFLEND parameter
. . . . . . . .
*MORE
SFLEND parameter
. . . . . . . .
*SCRBAR
Record not active . . . . . . . . .
SFLRNA
General keywords . . .
Subfile display layout
Subfile messages . . .
Select record keywords
TEXT keyword . . . . .
.
.
.
.
.
Name
Name
Name
Name
Y=Yes
Indicators/+
*MORE ...
More...
F3=Exit
F12=Cancel
Select Record Keywords
Record . . . :
MSGCTL1
Type choices, press Enter.
General keywords . . . . . . . .
Indicator keywords . . . . . . .
Overlay keywords . . . . . . . .
Y
Y=Yes
Y
Y
VRAMANA/EMPCUSTOR
RMO
*************** Beginning of data *****************************
0001.00
RMVMSG
PGMQ(*PRV) CLEAR(*ALL)
****************** End of data *******************************
Design the screen
Generate RPG program
0000.01 FMESSTAB
IF A E
K DISK
0001.00 FMKSSCR
CF
E
WORKSTN
0001.01 C
MOVEL
MSTATUS
S
1
0002.02 C
MOVEL
'*'
QUEUE
0003.00 C
MOVEL
'MKSFILE'
MSGFI
0004.00 C
PL01
PLIST
0005.00 C
PARM
MSGID
7
0006.00 C
PARM
MSGFI
10
0007.00 C
PARM
MSGDTA
10
0008.00 C
DOW
*IN03=*OFF
0008.01 C
MOVEL
0
ERROR
1 0
0008.02 C
MOVEL
0
ERROREMP
1 0
0012.00 C
WRITE
MSGCTL1
0013.00 C
EXFMT
MKSSEN
0013.01 C
CALL
'RMO'
0014.00 C
IF
EMPNUMB=*ZEROS
0014.01 C
MOVEL
1
ERROR
0014.02 C
MOVEL
1
ERROREMP
0015.00 C
MOVEL
'MKS0001'
MSGID
0016.00 C
MOVEL
*ZEROS
MSGDTA
0017.00 C
CALL
'MSG'
PL01
0017.01 C
ENDIF
0021.00 C
ENDDO
0022.00 C
SETON
****************** End of data *******************************
LR
CHAIN
The first matching records only
Looping is not necessary
The indicator setin the HI
It is not necessary
2. CRTSRCPF
By using this command to create source physical file. Default PF size is 92.
3.DSPFD
It is used to display the details about the file when it is created.
4. DSPFFD
It is used for listing details about Individual Fields
5.STRDFU
It is used to add Data into the records
6.STRSDA
It is used to go into screen Designing or Menu Designing
7.CRTMSGF
For creating the Message file
8.WRKMSGF
If you want to create or change or delete any message we can use this
command.
9.CRTDTAARA
For creating The Data Area
10.DSPDTAARA
For listing the content of Data area.
11.CHGDATARA
For changing the content of Data area.
12.DSPLIBL
For listing the contents of library
13.ADDLIBLE
For Adding a library into the current library.
14.RMVLIBLE
For Removing a library into the current library.
15.CHGCURLIB
For changing the Current Library to a new library
16.EDTLIBL
It is used to the edit of the library file. (Change library file it is temporary
delete the library file)
For Adding or Removing library lists.
17.SNDBRKMSG
Used for sending message to all user.
18.CRTPF
It is used to create a PF. Using this command we can set the maximum
number of records, whether delete or update operation is allowed or not, maximum
storage allocation, waiting time etc can be determined
19.CRTLF
To create the logical files.
20.STRRLU
To go into the RLU we are using this command. Default length of RLU is 132
if you give it and creating it very first time else it set the page width value of last
edited RLU. We can give the page width value from 1 to 378 in page width option.
21.DSPSBS
It is used to list the various subsystems running under AS/400 environment.
Various subsystems running are QINTER, QACTIVE, and QBATCH etc.
22.CRTRPGPGM
It is used to create an RPG program. We can determine what sort of source
file is generated. For example when we need the entire source compile as it is since
source is default. If we give *NOSOURCE only syntax errors is generated
NOSECLVL will not allows secondary message where as other setting is allowed it
and so on
23.CRTCLPGM
To create CL program
24.EDTOBJAUT
It is used to give authority to a particular source PF. For giving authority to
other user we must give authority to library, user profile and the source PF.
25.DSPOBJD
If we know library name and object name and we want to know the source PF
where it is residing then DSPOBJD with option as services instant of basic will give
the source PF name.
It describes various object descriptions like created Date, Created by, Source
Physical file, which it is being created, and so on.
26.STRSQL
To start into SQL.
27.WRKSPLF
To work with Spool file
28.DLTSPLF
To delete the spool file
29.CRTDUPOBJ
By using this command to create duplicate object. If you want to compile a PF
having 1000 of records and when we compile it all the data will be lost else if you
want to add or delete a attribute data for other fields will have to copied. For that we
a duplicate object.
30.CPYF
Records are being copied from PF to temporary file and after compiling it we
have to again copy back from temporary file to the original file. If we Add a
attribute we have to give *map and if we want to delete a attribute we have to give
*drop in the map entry field.
31.DLTF
After copying into the original file we have to delete the temporary file or if
you want to delete any file we are using this command. DLTF will only remove the
object
32.RMVM
It is used to delete the member as well as the object.
33.RUNQRY
To display all the records in a PF.
34.CRTCMD
It is used to display the rights given to a user. The system administrator can
change authority he can give the authority as a system administrator.
50.DSPDBR (data base relation)
This is used to list all the files, which are related to a PF. It displays all the LF
that is referring the PF and also lists the child table if it is having a relation through
ADDPFCST.
51.DSPJOB
It will display all the jobs submitted within the specific interval and display
the entire user who worked on the system at that time
52.WRKMSGQ
It will list all the messages of different user in the job queue.
53.CPYSRCF
If we want to copy all the members in a source PF to another source PF we
can use this command.
54.CPYTODKT
If we want to copy from source PF to a diskette file
55.CPYTOTAP
If we want to copy source PF to a tape then we can use this command.
56.STRDBG
If we want to debug a ILE program then we can use this command .We have
to create a ILE program by compiling with 15 which is CRTRPGMOD command
and take F10 give debugging values as *Source. This will create a module. Then we
have the create the program by giving program name and module name as the same
and if we are calling any other modules also in that include that in the CRTPGM
command
Ex: CRTPGM PGM (LIB/PNAME) MODULE (LIB/PNAME)
(LIB/SPNAME)
Now the program as well as the module is created. Then we have to start the debug
by using the command.
STRDBG PGM (LIB/PNAME) UPDPROD (*YES)
It will shoe the source code of the program and we have to press F6 set the break
point and press F10 key and call the program
CALL PNAME
F11-> display the variable
Shift + F11 -> go to module
102. Data types in CL?
TYPE ()
LEN ()
*DEC
Default (15 5)
VALUE ()
Default (0)
*CHAR
*LGL
Max (15 9)
Default (32)
1
Default (b)
Default (0)
VRAMANA/CLP
STRING
*************** Beginning of data ********************************
/*STRING *CAT *BCAT *TCAT FUNCTION */
PGM
PARM(&STR &STR1 &STR2 &STR3 &STR4)
DCL
VAR(&STR) TYPE(*CHAR) LEN(15)
DCL
VAR(&STR1) TYPE(*CHAR) LEN(15)
DCL
VAR(&STR2) TYPE(*CHAR) LEN(15)
DCL
VAR(&STR3) TYPE(*CHAR) LEN(15)
DCL
VAR(&STR4) TYPE(*CHAR) LEN(40)
CHGVAR
VAR(&STR2) VALUE(&STR *CAT &STR1)
CHGVAR
VAR(&STR3) VALUE(&STR *BCAT &STR1)
CHGVAR
VAR(&STR4) VALUE(&STR *TCAT &STR1)
SNDMSG
MSG(&STR3) TOUSR(SKANDASAMY)
SNDMSG
MSG(&STR4) TOUSR(SKANDASAMY)
SNDMSG
MSG(&STR2) TOUSR(SKANDASAMY)
ENDPGM
****************** End of data **********************************
run
call program name (string) f4
Program . . . . . . . . . . . . > STRING
Library . . . . . . . . . . . >
VRAMANA
Parameters . . . . . . . . . . . > VENKATA
> RAMANA
> ''
> ''
+ for more values > ''
Name
Name, *LIBL, *CURLIB
DSPMSG
104.
105.
109.
110.
Program 1
Store the time stamp and this time stamp will come as a input to the second program
Program2
Here wstmst1 contains the input time stamp and check this matches with the
database. If matches Update else send error message.
113.Define binder program?
The binder program means binding the procedure it is called binder program.
When you implement a program-level message monitor, I recommend that you use the message identifier CPF9999
instead of the widely used CPF0000. Using CPF9999 provides two important functions over CPF0000. First, CPF9999
catches some messages that CPF0000 will not catch because CPF9999 is the "Function Check" error, which occurs
only after some other program error, including errors triggered by CPFxxxx escape messages, MCHxxxx escape
messages (machine errors), and escape messages from other message identifier groups. CPF0000 only monitors for
actual CPFxxxx messages. Second, the CPF9999 "Function Check" message provides the actual failing statement
number, which is not available from the CPFxxxx error message. Specifying the CPF9999 message ID as the programlevel message monitor makes this additional information available.
114.question details?
DEFAULT CL MSGID?
CPF0000
Dspf windows type?
WINDOW
How many key define in logical file?
All the PF fields are create in key.
What is the level check error?
The level check error means RPGLE program is compiled and PF
or LF are compile suppose the PF or LF compile after the compiling the
RPGLE program this type of error is called level check error.
If you want to copy a PF without making any modification to it then
FORMAT keyword is used.
Default access path maintenance is *IMMED
Maximum no of printer files included in a RPGLE program is 8
Maximum no of files declared in RPGLE is 50 and CL is l
Maximum no of key fields included is 120
Maximum no of fields included in a PF is 8000
Maximum no of arrays included is a RPG is 200
Maximum no of parameter passed in a RPG is 255 and CL 40
Total no of system library is 15 and user library is 25
While logging on the first library to be included is QSYS
QGPL and QTEMP are user library
Printer file default length is 132.
Default size of a member is CRTSRCPF command for ordinary files is
92.
More Details
The CHAIN operation performs a random GET operation to the
database file. If the operation is successful, the data in the record is
copied to the input buffer. If the CHAIN operation fails, a record-notfound condition is signaled, typically via Resulting Indicator 1. If the
database file has been opened for UPDATE, the CHAIN operation
places a record lock on the retrieved record. No other application can
access this record for update while this lock is applied. Furthermore, if
another program has issued a lock to the record being accessed, the
CHAIN operation will wait for the database time-out period. If the
record is released during that period, the CHAIN operation continues.
If the other program does not release the record, the CHAIN operation
fails with an exception.
CHAIN with NO LOCK
The CHAIN operation supports the NO LOCK operation extender
(the old "half-adjust" column). In RPG III you specify an N in the
operation extender column, in RPG IV, you specify CHAIN (n) for the
operation code. Using NO LOCK allows you to access a record without
a record lock being applied, regardless of the way in which the file is
open. The record's data, however, is still copied to the input buffer
when NO LOCK is specified.
The SETLL operation performs a quasi READ LESS THAN OR
EQUAL operation. If the operation is successful, a READ PRIOR is
Your session is no longer controlling the remote job. The remote job
continues normally.
Special Considerations when Debugging a Web Browser/CGI
Program
To debug a CGI program that is evoked from a Web Browser session
running from the standard IBM HTTP Web Server, you need to do the
following in addition to the above.
Before Starting Debug for a Web Browser/CGI Session/Program
End the HTTP Server using the following CL command:
ENDTCPSVR *HTTP
WARNING!!! -- You MUST include *HTTP as the parameter for
ENDTCPSVR otherwise all TCP/IP server jobs (including telnet, ftp, smtp,
etc.) will be ended. And this is a bad thing. IBM sucks for making *ALL the
default for ENDTCPSVR.
C
C
C
C
C
C
endSL
ELSE
if
exsr
endif
endif
%FOUND( CustMast )
whatever...
Eval
7P 2 Inz(123.45)
text = 'The amount is: ' + %Char(
amount )
The TEXT field would contain the following after the EVAL
operation is performed:
'The amount is: 123.45'
Unlike %EDITC, the %CHAR built-in function trims off leading
blanks. However, %EDITC provides much more editing power than
%CHAR. Use %CHAR for basic number to character conversion.
119. What's new in V4R4 and RPG IV?
There are a few significant enhancements in RPG IV in OS/400
Version 4, Release 4.
The %CHAR built-in function has be fixed. It now functions like it was
supposed to in the first place. You can wrap a numeric value in %CHAR and a
nicely edited character form of the number is returned. The edited form includes the
decimal, trimmed off leading blanks, and a negative sign.
The FOR loop provides a free-format version of the DO operation code. With
the FOR operation, you can begin a loop operation and continue iterating through
the loop until a variable equals a limit value. The syntax for the FOR operation is
enhanced with the TO, BY and DOWNTO keywords. The TO operation indicators
the upper limit for the looping, while the BY keyword identifies the increment
value for the loop counter. Alternatively, you can specify the DOWNTO keyword
to loop backwards from a large value to a small value.
The OPENOPT keyword is added to the Header specification. This keyword
can be used along with its one and only keyword *INZOFL to cause overflow
indicators to be set off when their corresponding printer file is closed and then reopened during the program.
In subroutines, the LEAVESR operation can now be used to exit a subroutine
immediately. Effectively this is a "glorified goto" operation that branches to the
ENDSR statement of a subroutine.
2. Performance is improved because the compiler can generate more optimized code
for the CONST parameter.
After all, it was targeting ILE, why not refer to it as "ILE RPG"?
Second, the re-architecture of RPG came into question.
Unfortunately, the internal name "ILE RPG" began to be leaked
out to the public. Several magazine writers and IBMers not involved in
the development of RPG IV continued to use the term "ILE RPG"
when referring to RPG IV. I suppose these people still refer to the
AS/400 as SilverLake or perhaps even Olympic.
Then when IBM announced the compiler package or product name
as "AS/400 ILE RPG/400" it only added to the confusion. IBM
dropped the ball when promoting the RPG IV name. They are, after all,
set up to market their products with their product names. The name of
one programming language included in a product that contains nearly
seven full compilers isn't high priority.
RPG IV is the version of RPG that targets ILE. OS/400 V3R1
compatible RPG IV can also target what is now called "the original
program model" or simply OPM. OPM is just a name that has been
given to the original runtime environment of RPG and CL under
OS/400. This is the environment in which RPGIII and CL run. Under
ILE, however, the original native environment is emulated, that is, ILE
isn't an environment at all, it is native OS/400, whereas, OPM is now
an environment under ILE. Some very clever programming and design
went into this, don't you think? Not very many other operating systems,
if any, provide this kind of continuity.
RPG IV -- Release what?
RPG IV was first shipped with OS/400 Version 3, Release 1. This
is now referred to as RPG IV release 1. But don't worry about
remembering releases of RPG IV.
Under OS/400 Version 3, Release 6, IBM enhanced RPG with
procedures, many more built-in functions, and several new data types.
This is referred to as RPG IV release 2.
CISC
RISC
V3 R1
CISC
V3 R6
V3 R2
V3 R7
RISC
V4 R2
RISC
V3 R5 (speculation) CISC
See note 1
V4 R3
RISC
V4 R4 (February
1999)
RISC
V4
RISC
R5
or
RISC
CISC
(Summer
2000)
NOTE 1: It is speculated that IBM may ship a final "clean up" release
of OS/400 for CISC that would included a large level of compatibility
with OS/400 V4 R5.
The release levels of RPG IV are only important if you want to
keep track of that kind of thing. One disappointing issue is that unless
you stay on the most current release of OS/400, you don't get all the
cool new features in RPG IV. Even if you stay current, you can't target
prior releases if you use any of the new features. In fact, even if you use
a new feature that doesn't depend on an operating system enhancement,
it can't be used for back releases. This is because of the way the
TGTRLS (target release) feature has been implemented. Basically, if
you're on V4 R2 and you do a TGTRLS(V3R2M0) the compiler calls
the actual compiler for V3 R2. It doesn't have a built-in syntax checker
that says "This feature requires an OS/400 upgrade so don't allow it, or
this one is okay so accept it." It iscalling the same "binary" compiler
code that is on any old V3 R2 system. Which means, for example, that
if you want to take advantage of the new compiler directives, but you
often have to target a prior release, you can't use those directives. For
example, /IF DEFINED does nothing for the executable code that's
generated, but is not supported when TGTRLS(V3R2M0) is specified.
;( Bummer!)
So now we know about RPG IV release levels and how the term
"ILE RPG" got into our vocabulary. So let's clear up another term, the
name of the RPG language. The big one is the term "RPG/400". There
is not programming language called "RPG/400". The language most
often called "RPG/400" is RPGIII. However, back in the System/38
days, the System/38 RPG language was called RPGIII. When the
AS/400 was announced, programmers wanted to give themselves an
advantage on their rsum. So they began calling AS/400 RPGIII,
Formal Name
Proper
(correct)
Name
RPG/36
System/36-compatible
RPGII
RPGII
RPG/38
System/38-compatible
RPGIII
RPGIII
RPG/400
RPGIII
RPGIII
ILE RPG
RPG IV
RPG IV
S
S
.....CSRn01..............OpCode(ex)Extended-factor2++++++++++++++++++
C
Eval
nsize = %size(DinoArr) * 64
.....CSRn01Factor1+++++++OpCode(ex)Factor2+++++++Result++++++++Len++DcHiLoEq
C
Alloc
nSize
pDynoArr
%SIZE,
%ELEM,
%SUBST,
%TRIM,
Version and Release that the specific built-in functions were introduced
and/or enhanced.
NOTE: IBM Seems to skip-ship the RPG IV compiler. So RPG IV in
V4R1, V4R3 and V4R5 have no new functionality. The next scheduled
upgrade is OS/400 V5R1 in Spring 2001.
Version Built-in
Release Function
Parameters
Return Value
Description
V3R7
%ABS
numeric expression
Absolute value of
expression
%ADDR
variable name
Address
variable
V5R1
%ALLOC
memory size
Pointer to the
allocated storage.
V4R2
V4R4
%CHAR
V5R1
%CHECK
compare-value
: First position in
data-to-search { : the searched-data
that contains a
start-position }
character not in
the list of the
characters in the
compare value.
V5R1
%CHECKR
compare-value
: Last position in
data-to-search { : the searched-data
that contains a
start-position }
character not in
the list of the
characters in the
compare value.
of
in
data
(Search
begins
with the rightmost
character
and proceeds to
the left.
V5R1
%DATE
V5R1
%DAYS
days
V3R7
%DEC
V3R7
%DECH
A duration value
that can be used
in an expression
to add a number
of days to a date
value.
V3R7
%DECPOS
numeric expression
V5R1
%DIFF
V4R4
%DIV
Numerator
Denominator
V3R7
%EDITC
V3R7
%EDITFLT
numeric
expression
V3R7
%EDITW
%ELEM
%EOF
{file name}
V4R2
Number
of
decimal digits.
: Performs integer
division
and
returns
the
quotient (result)
of that division
operation.
Character
external display
representation of
float.
of
or
to a subfile (for a
particular file, if
specified) | ended
in an end-of-file
or | beginning-offile condition '0'
otherwise.
V4R2
%EQUAL
{file name}
V4R2
%ERROR
V3R7
%FLOAT
numeric expression
Value in
format.
V4R2
%FOUND
{file name}
match (CHECK,
CHECKR,
SCAN)
'0'
otherwise.
V4R4
%GRAPHIC
Any
value
character Converts
character data to
double-byte
character
set
value.
V5R1
%HOURS
hours
A duration value
that can be used
in an expression
to add a number
of hours to a time
value.
V3R7
%INT
numeric expression
Value in integer
format
V3R7
%INTH
numeric expression
Half-adjusted
value in integer
format
V3R7
%LEN
any expression
1. Returns the
length of a
variable or
literal
value,
or
the current
length of a
varying
length field.
2. When used
on the left
side of the
equal sign,
sets
the
length of a
varying
length field.
search-data : array
{ : start-index { :
elements to search
}}
An array index of
the element in the
array where the
search-data
is
located.
V5R1
%LOOKUPxx
V5R1
%TLOOKUPxx search-data
: *ON if the search
successful,
searched-table { : is
otherwise *OFF.
alternate-table }
(NOTE:
The
indexes of the
searched-table
and
alternatetable are set to
the index of the
search-data
if
*ON is returned.)
V5R1
%MINUTES
minutes
A duration value
that can be used
in an expression
to add a number
of minutes to a
time value.
V5R1
%MONTHS
months
A duration value
that can be used
in an expression
to add a number
of months to a
date value.
V5R1
%MSECONDS
milliseconds
A duration value
that can be used
in an expression
to add a number
of milliseconds to
a time value.
V3R7
%NULLIND
null-capable
name
V5R1
%OCCUR
data-structure
The
current
occurrence of the
data structure, or
sets the current
occurrence of the
data structure
V4R2
%OPEN
file name
%PADDR
procedure name
Address
procedure
of
Number
parameters
passed
procedure
of
V3R2
V3R6
field Value
in
indicator format
representing the
null
indicator
setting for the
null-capable
field.
%PARMS
V5R1
%REALLOC
pointer : new-size
V4R4
%REM
Numerator
Denominator
to
Pointer to the
allocated storage.
: Performs integer
division
and
returns
the
remainder from
the
division
operation.
V4R2
%REPLACE
replacement string:
source string {:start
position {:source
length to replace}}
String produced
by
inserting
replacement
string into source
string, starting at
start position and
replacing
the
specified number
of characters.
V3R7
%SCAN
search argument :
string
to
be
searched
{:start
position}
First position of
search argument
in string or zero,
if not found.
V5R1
%SECONDS
Seconds
A duration value
that can be used
in an expression
to add a number
of seconds to a
time value.
V5R1
%SHTDN
%SIZE
elements of the
array, or all the
occurrences
of
the data structure.
V5R1
%SQRT
expression or value
The
square
root of the
expression or
value.
V4R2
%STATUS
{file name}
0 if no program
or
file
error
occurred
since
the most recent
operation
code
with extender 'E'
specified
most
recent value set
for any program
or file status, if
an error occurred
if a file is
specified,
the
value returned is
the most recent
status for that
file.
V3R7
%STR
pointer{:maximum
length}
Characters
addressed
by
pointer argument
up to but not
including the first
x'00'.
V5R1
%SUBDT
equivalent of the
EXTRCT
operation code.)
%SUBST
V5R1
%THIS
V5R1
%TIME
V5R1
string
%TRIML
string
%TRIMR
string
V4R4
%UCS2
Any
value
V4R2
%UNS
numeric expression
Value
in
unsigned format
V4R2
%UNSH
numeric expression
Half-adjusted
value in unsigned
format
V5R1
%XLATE
converted
from-table : to- The
table : string-to- string is returned.
convert { : startingposition }
V4R4
%XFOOT
Array name
Cross
foots
(totals) all the
elements in an
array.
Y=Yes
Indicators/+
Display subfile records . . . . . .
Y
40
Display control record . . . . . . .
Y
40
Keyword
SFLCTL
SFLCSRRRN
SFLMODE
SFLDSP
SFLDSPCTL
SFLINZ
SFLEND
SFLDLT
SFLCLR
N40
. . . . . . .
40
SFLEND parameter
. . . . . . . .
SFLEND parameter
. . . . . . . .
*MORE ...
Record not active . . . . . . . . .
Y
*MORE
*SCRBAR
SFLRNA
Keyword
CFnn/CAnn
Indicators/+
Subfile initially truncated . . . .
Subfile initially folded . . . . . .
Use instead of Enter key . . . . . .
More...
F3=Exit
F12=Cancel
SFLDROP
SFLFOLD
SFLENTER
The maximum no. of objects that can be declared in a CL program are __One__.
The command used to trap errors in a CL program is ___MONMSG_____.
___PARM____ is the keyword used to pass parameters in a CL program.
How many datatypes are available in CL/400? What are they?
2 marks
Three - *CHAR, *DEC, *LGL
5. The command analogous to DSPLY opcode is __ SNDPGMMSG MSG(xxxxxx)__.
6. Write the code to move a decimal value into a character variable.
CHGVAR VAR(&C) VALUE(&D) where &A is character variable and &D is decimal value.
7. How will you execute the format of a display file in CL/400?
SNDRCVF
8. What is the length of a CL variable name?
11 characters including &
9. What is a data area? How many types of data area are there?
2 marks
A Data Area is an Object on AS/400 of the type *DTAARA. This stores a single value of data in a
flat format and can be used by one or many programs. The different types are:
a) *LDA local data area b) General Data area
c) Group Data Area
d) Program initialized parameter data area
10. Write the command to get the system date and display it?
2 marks
RTVSYSVAL SYSVAL(QDATE) RTNVAR(&M)
SNDPGMMSG MSG(DATE IS *CAT &M) where &M is a character variable of length 6
11. What is the syntax to convert the date from one format to the other?
2 marks
CVTDAT DATE(&D1) TOVAR(&D2) FROMFMT(*EUR) +
TOFMT(*JIS) TOSEP(/)
Common Questions
1. How many files can be used in a CL.
2. How many files can be used in RPG (3).
3. What is the difference between RPG3 AND RPG4.
4. What is static binding and dynamic binding?
5. How do you check for error in CL?
6. What is the use of Ovrdbf?
7. What is the use of open query (OPNQRY)?
8. How do you use the Open Query file in the RPG?
9. How do you submit a job?
10. What is the difference between Move and Movel?
11. What is the difference between Move and Eval?
12. What does Seton LR do?
13. What is the difference between Seton LR and Seton RT?
14. How do you check for error in RPG?
15. Can we execute a statement after Seton LR?
16. How do we control the opening of the files and Closing of the files in RPG?
17. What are the various kinds of Subfiles?
18. When do we use a load all Subfile?
19. What are the basic keywords required for a subfile?
20. Can we use SFLRCDNBR for a Page = Size Subfile. Will it compile (DDS)
21. Why a LF is required? What are the benefits and Overhead?
22. How many formats can a PF/LF/JLF contain?
23. What is the use of multiple member file?
24. What happens if the RRN is Zero in a Subfile and Display Subfile Indicator is Seton
and Exfmted?
25. How do I change the PF without losing the data?
26. What are the implications of the same?
27. How the same can be overcome?
28. I do change the PF with the CHGPF command and use one of its logical in a PGM
what happens to the PGM?
29. How many kinds of Arrays are available?
30. How many kinds of Data Areas are available?
31. I have a Select statement and When clause/s there are cases where the When
clause satisfies, how many clauses gets executed.
32. What is the difference between DOW and DOUNTIL?
33. What is the data type of the Indicator?
34. How can I retrieve the value of a particular element in an Array?
35. How do you journal a file?
36. What is the use of commitment control?
37. What happens if I have a file under commitment control and I have done a Read on
the same and Updated the file, again I am trying to update the same record or Read the
record? Will there be any error? IF so why? How to fix the same?
38. What are the uses of procedures?
39. How to invoke the procedure?
40. How do we write a procedure? (Steps)
41. How do we execute a CL command from a RPG?
42. Some keywords that can be used in Printer file/ Display file.
43. How do we monitor for the end of file in CL? CPF0864
44. How do you handle for end of file in RPG (Built ins for Chain/ Read / Reade)
45. What are the I/O operations that can be done on the Subfile?
46. If we modify a value of Subfile record, how do we retrieve the same?
47. What if the changed value in the Subile is erroneous? How can we check it and ask
the user to rectify the same?
48. What is the use of SFLNXTCHG? Explain what is MDT.
49. What is the accpth?
RPG
1) Three types of subfiles.
Single page / Load All / Expanding
2) What are the keywords that distinguish between the three types of subfiles
Single Page
SFLSIZ = SFLPAG
Expanding subfile SFLSIZ > SFLPAG
Expanding subfile SFLSIZ > SFLPAG
What are the opt codes that are used to read subfile records.
READC, CHAIN
3) How can I read a changed record in the second cycle of read of a subfile
Keyword- SFLNXTCHG
4) In a Selec /When/ Endsl sequence if all the WHEns evaluate to true which statements
execute.
5) Evaluate this statement
MOVE 1 FLD1
FLD1
IFNE
1
FLD2
ORNE
1
Y DSPLY
ELSE
N DSPLY
ENDIF
6) Evaluate this statement
Z-ADD 0
FLD1
MOVE
103.25
FLD1
FLD1
DSPLY
10,3
FLD1 = 10.325
7) Evaluate this statement
KEYVAL SETLL FILE1
*IN01
DSPLY
XXXX01
Value = 1
8) Evaluate this statement
KEYVAL READE FILE1
*IN01
DSPLY
XXXX01
Value = 0
9) Format level identifier and its use. Follow it with Can I change a structure of a file and
then not compile the RPG program.
If you have ever modified a physical file (e.g., added a new field or changed the length of an existing field) and you
didn't recompile the programs that use that file, you probably found out the hard way about file level-checking. If levelchecking is active for that file (which is the default), any program that has not be recompiled will receive an escape
message when called. The process of level-checking for a file is to ensure that programs using that file always use the
current definition of the file, hence ensuring data integrity.
How file level-checking works
There are five steps to the file level-checking process:
1.
Creation of the record format level-identifiers. When you create a file (physical, logical, display, printer and communications file
types), the system generates a level-identifier for each record format in the file. The system uses a sophisticated hashing algorithm to
generate a unique identifier based on the record name, the number of fields, the field names, the field types and the field lengths.
2.
Creation of the file level-identifier. The system also creates a single level-identifier for the file itself. This is simply the timestamp of
when the file was created.
3.
Compiler copies the file level-identifier and the record format level-identifier(s) into the program. When you create a program
that uses a file, the level-identifiers are copied into the program. The compiler stores, in the program, copies of the file level-identifier
and the record format level-identifiers for each record format used by the program. You can use the Display Program References
command (DSPPGMREF) to view the files used by a program and the associated level-identifiers.
4.
File level-identifier check at program run-time. When a file is opened by a program the system checks the file level-identifier
stored in the program against the current file level-identifier in the file (recall, this is the timestamp of when the file was created). This
check determines if the file has been recreated since the program was compiled. If the level-identifiers match, the process is done and
the program runs as normal.
5.
Record format level identifier check at program run-time. If the file level-identifiers did not match (in step 4), then the system
checks the record format level-identifiers. Each one stored in the program is checked against the corresponding level-identifier in the
file. If a mismatch is found, the program gets a "record format level check" escape message. To correct the problem you need to
recompile the program.
*NO for this parameter. Note, however, that you cannot specify *YES for this parameter, so you cannot turn on
level checking at run time for a file created with LVLCHK(*NO).
CLP
11) How to read a database file in a CL program
12) How to check for end of file
Ans:- CPF0864
13) Can I use an override to position in a database file
14) Display a record format in CL program
15) How to submit a program in batch
16) How do you debug an RPG program.
17) Three ways of copying a file.
CRTDUPOBJ
CPYF
INSERT INTO
I have a program object I need to identify the location of the source
DSPOBJD OBJ (XXXX) (*SERVICE)
How to check an object exists on the system in a CL program.
How to display record locks
1) Where do system libraries reside?
2) How to get the length of data in a variable? Not the length of variable.
3) How to use TEST opcode for a alphanumeric variable?
4) Why use LF with key and not PF with key if no maintenance considerations.
5) Whats FIFO?
6) Can u have a PF with fields derived from 2 field reference files?
7) Can u have an LF defined on all the members of a PF at once? If so how?
8) How do u know when a Batch Job has ended?
9) How will u use a pgm to change current library list?
10)
How will u use a pgm to change library list for an interactive job after a batch
job?
11)
12)
13)
14)
What are modules, service programs, can u see the code of service pgms if u
16)
What is difference between *SRVPGM and a normal RPGLE pgm both can
18)
What are the types of access path maintenance? Explain each of them.
Immediate maintenance of an access path means that the access path is maintained as changes are made to its associated data,
regardless if the file is open. Access paths used by referential constraints will always be in immediate maintenance.
Rebuild maintenance of an access path means that the access path is only maintained while the file is open, not when the file is closed;
the access path is rebuilt when the file is opened the next time. When a file with rebuild maintenance is closed, the system stops
maintaining the access path. When the file is opened again, the access path is totally rebuilt. If one or more programs has opened a
specific file member with rebuild maintenance specified, the system maintains the access path for that member until the last user
closes the file member.
Delayed maintenance of an access path means that any maintenance for the access path is done after the file member is opened the
next time and while it remains open. However, the access path is not rebuilt as it is with rebuild maintenance. Updates to the access
path are collected from the time the member is closed until it is opened again. When it is opened, only the collected changes are
merged into the access path.
If you do not specify the type of maintenance for a file, the default is immediate maintenance.
MAINT parameter comparison
Table 2 compares immediate, rebuild, and delayed maintenance as they affect opening and processing files.
Table 2. MAINT Values
Function
Immediate Maintenance
Rebuild Maintenance
Open
Fast open because the access path Slow open because access path
is current.
must be rebuilt.
Process
Delayed Maintenance
Note:
1.
Delayed or rebuild maintenance cannot be specified for a file that has unique keys.
2. Rebuild maintenance cannot be specified for a file if its access path is being journaled.
MAINT parameter tips
The type of access path maintenance to specify depends on the number of records and the frequency of additions,
deletions, and updates to a file while the file is closed.
You should use delayed maintenance for files that have relatively few changes to the access path while the file
members are closed. Delayed maintenance reduces system overhead by reducing the number of access paths that are
maintained immediately. It may also result in faster open processing, because the access paths do not have to be rebuilt.
You may want to specify immediate maintenance for access paths that are used frequently, or when you cannot wait for
an access path to be rebuilt when the file is opened. You may want to specify delayed maintenance for access paths that
are not used frequently, if infrequent changes are made to the record keys that make up the access path.
In general, for files used interactively, immediate maintenance results in good response time. For files used in batch
jobs, either immediate, delayed, or rebuild maintenance is adequate, depending on the size of the members and the
frequency of changes.
19)
How to copy 1000 record from 10000 records using CPYF, tell the keywords.
20)
Whats the difference between CALL, CALLB, CALLP when are they used?
21)
What are the different ways of transferring control from one pgm to another?
22)
DataQs, what happens to the dataq after the data has been sent?
23)
24)
25)
26)
If I use a field reference file and a COLHDG is defined in that and while using
28)
29)
30)
31)
32)
33)
34)
35)
procedural file?
36)
37)
38)
39)
40)
41)
42)
43)
44)
environment?
45)
46)
program as parameter?
47)
48)
10)
How to find the Program name and some related information. Options had
SDS etc.
11)
An expression using op-codes was to be converted using built in functions %Dec and %DECH.
12)
What is the correct syntax for Op-code Test(D)
13)
When does a indicator defined in 73-74 position seton while chaining a
record.
14)
Except keyword. A file defined in F spec as O type and a DS defined in D
spec. How can the file be updated using the DS.
Section 3 Advanced RPG Programming
1) Complex Logical expression using Indicators and a variable. Analyzing and
determine the result of the variable.
2) Setting the indicator value by using logical expressions.
*IN50 = (A = B)
what will be the indicator value.
3) With the same condition as above a complex piece of code was given and the result
was to be determined.
4) A complex logic in words using and either, or, neither to be written in expression.
5) A complex piece of code with a variable using ITER and LEAVE was given and
analyzing that code the value of that variable was to be determined.
6) How to include a service program in your program.
7) While creating the program if *OWNER is given to the usrprf parameter what is its
significance.
8) A program A compiled with activation grp. *New calls a program B compiled in
activation grp. QILE. Program B has the following code: Count = count + 1
Seton RT
After the program has been invoked 3 times. What will be the value of count?
9) A Question on the same lines as above but not in different activation group. What
will be the value of count?
10)
Where is a prototype defined.
11)
Select the right prototype definition. Extpgm definition was used?
12)
A piece of code for sub procedures was given. What is the length of the value
returned?
13)
API for ovrdbf.
Section 4 Subfiles
1) There are some 200 records to be loaded. The roll up/down keys should be very
fast. Which loading technique to be used.
2) What does the keyword SFLNXTCHG do.
3) What does the keyword SFLRCDNBR do.
4) A piece of code was given using SFLRCDNBR. At what position the cursor will
be?
5) There was a piece of code having different keywords along with there indicators.
What will be the indicator positions to initialize the sub file.
6) If a record has been deleted and you dont want do display it on the subfile
anymore. What is the best possible way to do it?
VALUE(100)
VALUE(0)
0005.00
DCL
VAR(&D)TYPE(*CHAR)LEN(3)
0006.00
CHGVAR VAR(&C)VALUE(&A+&B)
* CHGVAR is used to replace the value of a variable with some other value.
0007.00
CHGVAR VAR(&D)VALUE(&C)
0008.00
SNDPGMMSG MSG(THE SUM IS: *CAT&D)
* This will send a message on the console.
0009.00
ENDPGM
* ENDPGM ends the program
**************End of data********************
0006.00
TOFMT(*JIS) TOSEP(/)
* CVTDAT convert dat
0007.00
SNDPGMMSG MSG(DATE *CAT &D2)
0008.00 ENDPGM
**************End of data********************
Columns. . .: 1
71
Edit STDLIB/SAMMAN
SEU==>
HLLPGM12
0001.00 FKIRAN3 IF E K DISK
0002.00 C
READ EMPREC 55
0003.00 C *IN55 DOWEQ*OFF
0004.00 C BASICDSPLY
0005.00 C DEPT DSPLY
0006.00 C
READ EMPREC
55
0007.00 C
ENDDO
0008.00 C
SETON
LR
TEST ON CL Programming
Total Time: 1 hr
Tot. Marks: 50
*dec
*char
*log
*lgl
Ans-(c)
2.
Predict which programs will be executed in the following code when &Opt = 1:
IF COND(&Opt *EQ 1)
THEN ( Call Pgm4)
ELSE
CMD(Call Pgm3)
CALL Pgm(Pgm2)
CALL Pgm(Pgm1)
Which of the following files can be used in the TOFILE parameter of CPYF?
Logical file
Join Logical file
Tape file
None of the above
a)
b)
c)
d)
(c)
4.
a)
b)
c)
d)
(A)
5.
What is the command used to find all logical files based on one physical file?
DSPDBR
DSPOBJD
DSPPFM
a and b
a)
b)
c)
d)
(a)
6.
a)
b)
c)
d)
(b)
7.
a)
b)
c)
d)
c)
Two types of files are supported in CL procedures and programs: display files and database files.
You can send a display to a workstation and receive input from the workstation for use in the procedure or
program, or you can read data from a database file for use in the procedure or program. Subfiles (except for
message subfiles) are not supported by CL procedures and programs.
Only input operations, with the RCVF command, are allowed. The WAIT and DEV parameters on the
Receive File (RCVF) command are not allowed for database files. In addition, the SNDF, SNDRCVF,
and ENDRCV commands are not allowed for database files.
DDS is not required to create a physical file which is referred to in a CL procedure or program. If DDS
is not used to create a physical file, the file has a record format with the same name as the file, and there
is one field in the record format with the same name as the file, and with the same length as the record
length of the file (RCDLEN parameter of the CRTPF command).
The file need not have a member when it is created for the module or program. It must, however, have
a member when the file is processed by the program.
The file is opened for input only when the first Receive File (RCVF) command is processed. The file
must exist and have a member at that time.
The file remains open until the procedure or OPM program returns or when the end of file is reached.
When end of file is reached, message CPF0864 is sent to the CL procedure or program, and additional
operations are not allowed for the file. The procedure or program should monitor for this message and
take appropriate action when end of file is reached.
The following statements apply only to display files used with CL procedures and programs: Display files may have
up to 99 record formats.
All data manipulation commands (SNDF, SNDRCVF, RCVF, ENDRCV and WAIT) are allowed for
display files.
The display file must be defined with the DDS.
The display file is opened for both input and output when the first SNDF, SNDRCVF, or RCVF
command is processed. The file remains open until the procedure or OPM program returns.
Note: The open does not occur for both types of files until the first send or receive occurs. Because of this,
the file to be used can be created during the procedure or program and an override can be performed
before the first send or receive. However, the file must exist before the module or program is compiled.
Override with Display File (OVRDSPF) Allows a run-time override of a file used by a procedure or program with a display file.
Override with Database File (OVRDBF) Allows a run-time override of a file used by a procedure or program with a database file.
Indicator variables are declared in your CL procedure or program in the form of logical variables with names &IN01
through &IN99 for each indicator that appears in the device file record formats referred to on the Declare File (DCLF)
command.
When you use CL support, the file referred to is implicitly opened when you do your first send, receive, or send/receive
operation. An opened display file remains open until the procedure or OPM program in which it was opened returns or transfers
control. An opened database file is closed when end of file is reached, or when the procedure or OPM program in which it was
opened returns or transfers control. Once a database file has been closed, it cannot be opened again during the same call of the
procedure or OPM program.
Do not specify LVL(*CALLER) on the Reclaim Resources (RCLRSC) command in CL procedures and programs using files. If you
specified LVL(*CALLER), all files opened by the procedure or OPM program would be immediately closed, and any attempt to
access the file would end abnormally.
You use the open file identifier (OPNID) parameter to uniquely identify an instance of a declared file so that multiple files can be
declared. If you use the OPNID parameter, then for a field, the CL variable name is the field name preceded by an ampersand (&),
the OPNID value, and an underscore (_). For an option indicator, the CL variable name is the indicator preceded by an ampersand
(&), the OPNID value, an underscore, and IN.
You cannot use record formats that contain floating point data in a CL procedure or program.
Except for message subfiles, any attempt to send or receive subfile records causes run-time errors.
8.
(b)
9.
a)
b)
c)
d)
(b)
What is the difference between program level and command level MONMSG?
2.
3.
4.
5.
6.
Program level MONMSG should be specified only after all DCL statements
7.
How do you know the keys used in a physical file without using SEU?
8.
9.
Which has the highest priority if you give both program level MONMSG and command level
10.
MONMSG?
Two objects with same name and type cannot exist in different libraries FALSE
2.
The built-in menu called MAJOR organizes all the AS/400 commands
3.
4.
5.
The current library cannot be a duplicate of any library in the library list FALSE
6.
The RETURN command in a program removes that program from the program stack
TRUE
7.
A data area is an object used to hold data for access by any job running on the system.
TRUE
8.
9.
LDA can be used to pass information to a subprogram without the use of a parameter list TRUE
10.
SNDPGMMSG command allows us to send messages to a work station user or the system operator.
TRUE
FALSE
TRUE
FALSE
TRUE
2.
Declare commands must precede all other commands except the PGM command. (TRUE/FALSE)
3.
4.
___MONMSG_____ Monitors for escape, status, and notify messages sent to a program's message queue
6.
TRUE
FALSE
1. In the same library there can be objects of the same name of different object types.
This statement is
a) True
b) False
c) None of the above
a)
2. Types of jobs on OS/400 are
a) 2
b) 3
c) 4
d) 5
Job types
The iSeries server processes several different job types. You can select one of the following job types to learn more
about that job type.
Server jobs are jobs that have set the server type using the Change Job (QWTCHGJB) API, and they will have an
additional classification of Server with one of the following job types:
Autostart
An autostart job is started automatically when the subsystem it is associated with starts.
Batch
A batch job is a predefined group of processing actions that is submitted to the system.
Communications
A communications job is a batch job that was started by a program start request from a remote system.
Interactive
An interactive job requires input from a signed-on user and an iSeries server.
Prestart
A prestart job is a batch job that starts before a work request is received. The two types of prestart jobs:
Prestart communications - The job is a communications batch job that starts running before a remote system sends a
program start request.
Prestart batch - The job is a batch job that starts before a work request is received.
3. Save file is an object and it is used for the backup. This statement is
a) True
b) False
c) None of the above
a)
4. In join logical file you can have multiple files and multiple record formats. This
statement is
a) True
b) False
c) None of the above
b)
5. To show the physical file member, its attribute and its logical files commands used is
a) DSPDBR
b) DSPFFD
c) DSPFD
d) DSPPFM
a) and d)
6. To look at the job correct ser of command used is
a) WRKACTJON, WRKSBMJOB, DSPJOB, WRKUSRJOB
b) WRKSBMJON, WRKSBSJOB, WRKUSRJOB
c) WRKACTJOB, WRKSBSJOB, DSPJOB, WRKUSRJOB
Ans : - c)
7. DYNSLT keyword is used in
a) Physical file
b) Logical file
c) Both
d) None of the above
b)
8. Command function and command attention Key performs the same function and have
same concept. . This statement is
a) True
b) False
c) None of the above
b)
9. OPNQRY FILE AND LOGICAL FILE both are used to access the database file only.
This statement is
a) True
b) False
c) None of the above
a)
10. Which statement is false
a) QUERY400, OPNQRYF, LOGICAL FILE all are objects.
b) Logical file is an object
c) QUERY400 is a system supplied utility
d) OPNQRY is not an object
a)
11. There are 2 physical files. File(a) is having 3 logical file and other File(b) is having
2 logical file. Which can be easily complied with out deleting its dependent logical file
a) File(a)
b) File(b)
c) None of the above
Ans : - c)
12. In join Logical File Min. files required are
a) 1
b) 6
c) 32
d) None of the above
Ans : - a)
13. In join logical file Max files required are
a) 2
b) 4
c) 6
d) 32
Ans : - d)
14. To find a string CL command used is
a) FNDSTRPDM
b) ALCOBJ
c) DSPFD
d) None of the above
Ans : - a)
15. Please read the following CL statements
Program A
CALL PGM (B)
OPEN FILE X
OPEN FILE A
Program B
OVRDBF FILE (X) FILE (Y)
OVRDBF FILE (A) TOFILE (B) OVERSCOPE (*JOB)
RETURN
The file opened in the program A is
a) File A,X
b) File B.Y
c) File X,B
d) File Y,A
c)
16. Please read the following CL statements.
Program A
OVRDBF FILE(B) TOFILE(C)
OVRDBF FILE(A) TOFILE(B)
OPEN FILEA.
File opened will be
a) A.
b) B
c) C
d) None of the above
c)
16. Read the following statements
Program A
OVRDKTF FILE(A) ToFILE(B)
ENDPGM
Program B
OPEN FILEA
File Opened will be
a) A.
b) B
c) None of the above
A)
17. You can send a message in the program through subfile. . This statement is
a) True
b) False
c) None of the above
Ans : True
18. QCMDEXC is a system supplied API. This statement is
a) True
b) False
c) None of the above
Ans : - True
19. You can display a error message only on 24th Line in a display file. . This statement
is
a) True
b) False
c) None of the above
Ans : - b)
20. You can define (a) Only one file in CL program .(b) & update the database file
through CL program .In this statement
a) A is true B is false
b) B is true A is false
c) A & B are true
d) A & B are false
Ans:- a)
21. You can get the user information in the CL program by using command
a) RTVJOBA
b) RTVUSRPRF
c) DSPJOBA
d) RTVSYSVAL
e) None of the above
b)
22. (A ) call in the CL program will pass control to the next program. (B) while
RETURN command remove the procedure from the call stack .In This statement
a) A is true B is false
b) B is true A is false
c) A & B are true
d) A & B are false
b)
23. (A) Call in the CL program will pass control to the next program and again back to
the calling program.(B) while TFRCTL command removes the calling program from
the call stack. In this statement
a) A is true B is false
b) B is true A is false
c) A & B are true
d) A & B are false
Ans : - c
24. Wait command is used in CL program only. This statement is
a) True
b) False
c) None of the above
Ans : - a)
QUESTIONS : simple
####################
1. Give examples of DCL, DDL, DML SQL commands.
A. DATA CONTROL LANGUAGE(DCL)- grant , revoke.
DATA DEFINITION LANGUAGE(DDL)- create, alter , drop.
DATA MANIPULATION LANGUAGE(DML)- select, insert, update, delete.
2.What are data types? What is meant by null? Give examples of operators.
A. Data types are attributes of columns, literals and host variables. They are SMALLINT,
INTEGER, FLOAT, DECIMAL, CHAR, VARCHAR, DATE, TIME, TIMESTAMP,
GRAPHIC, VARGRAPHIC. NULL is a special value that indicates the absence of data
in a column. Operators: - , + , * , / , :: concatenation, date, day, year, days, substr , current
date, current time, user.
3. What are the column or aggregate functions available in SQL?
A. AVG for average, COUNT for counting the number of rows in the result table, MAX
which returns the maximum value in the column , MIN which returns the minimum
value, SUM which gives the sum total of the column.
4. Explain the usage of the terms GROUP BY, HAVING, ORDER BY.
A. GROUP BY - the column function will calculate its result based on the individual
groups created by GROUP BY specification creating one result for each group.
HAVING - is used to specify the conditions each row of each returned group must
satisfy.
ORDER BY - used to sort the output of a query using the column names or position of
column in the list of columns named in the select expression.
5. What does the LIKE and IN and BETWEEN search operators allow you to do?
A. They search for rows where the column specified satisfies one among a number of
values.
LIKE - to select rows based on a similarity of partial strings.
( - for a single unknown char and % for 0 to any no. of unknown char)
IN - to select rows where the column values are one among a specific list of values.
BETWEEN - to select rows having column values within the given limits.
6. What are the DB2 objects that can be created using CREATE statement?
What are the DB2 objects you require before creating a Table?
A. TABLE, INDEX, VIEW, SYNONYM, ALIAS, STOGROUP, DATABASE,
TABLESPACE.
Tablespace and Database are required before creating a table.
4. What is the difference between a base table, view, synonym, alias, index?
Base table - table that physically exists and has physical stored records ,can be updated.
Locking - used to ensure the integrity of data and prevents concurrent users from
accessing
inconsistent data. The data is locked until a commit is executed to release
the updated data.
Concurrency - allows more than one DB2 application process to access the same data
at
essentially the same time.
COMMIT - allows data changes to be made permanent, frees all locks so that other
applications can access the data, closes any open cursors being processed.
The recoverable processing is that done between two commits.
ROLLBACK - allows data changes (updates) made by pgm. since the previous
commit to
be undone, locks are released, cursors are closed.
2. What is cursor stability and repeatable read? What are the AQUIRE &
RELEASE parameters?
A. Cursor stability - tells DB2 that database values read by its application are protected
only while being used. Changed values are protected until the application reaches a
commit point.
Repeatable read - rows referenced by the program cannot be changed by other pgms.
until the program reaches a
commit point.
AQUIRE, RELEASE parameters on the BIND command specify when tablespacelevel
locks are to be acquired and released. The parameters are:
Aquire- USE : locks are required on first use.
ALLOCATE: locks are required when the PLAN is allocated.
Release- COMMIT: all Tablespace-level locks are released at each synchpoint.
DEALLOCATE: locks are held until the PLAN is deallocated.
3. What is a PLAN? What is DBRM? Where are PLANs stored? What does FREE
command do?
A. PLAN- a DB2 object produced during the bind process that associates one or more
DBRMs.
DBRM- (data base request module) is a DB2 component created by DB2 precompiler
containing the SQL source statements extracted from the application
program
and is used as input to BIND process.
BIND- process that builds access paths to DB2 tables, uses the DBRMs and produces
an application plan. It also checks the users authorization level and validates
the
SQL statements in the DBRMs.
PLANs are stored in sysibm.sysplan.
FREE - will drop the existing PLAN.
4. When do the following SQL codes occur?
A. +000 successful execution.
-904 unavailable resource
-811 embedded SQL returning more than one rows
-100 row not found
-925 commit not valid
5. What is meant by attachment facility? What command is used by TSO users to
invoke DB2 ?
What does DSNDB07 database do?
A. The attachment facility is an interface between DB2 and TSO, IMS/VS, CICS, or
batch address
spaces. It allows application programs to access DB2.
DSN RUN command is used.
DSNDB07 is where the DB2 does its sorting, it includes DB2s sort work area and
external storage.
6. What do the following contain?
A. sysibm.sysdatabase - one row for each database.
sysibm.sysdbrm - one row for each dbrm.
sysibm.sysplan - one row for each plan.
sysibm.sysdbauth - shows which authids have privileges on which databases.
sysibm.sysplanauth- shows which authids have privileges on which plans.
sysibm.sysrels- one row for each referential constraint.
Printed
1.) What is needed in an RPG program to receive parameters?
An *ENTRY parameter list.
2.) What is KLIST used for?
To define a composite key.
3.) What is CASxx used for?
To execute subroutines based upon the result of a logical comparison.
Subfiles:
29.) What DDS keywords are required when defining a control record format?
SFLCTL, SFLDSPCTL, SFLPAG, SFLSIZ.
30.) What operation codes can be used to retrieve subfile record?
READC and CHAIN.
Ans:- READC
31.) Explain 2 ways of handling the roll-up/roll-down keys in an RPG subfile program.
If SFLSIZ > SFLPAG, OS/400 will handle scrolling.
If SFLSIZ = SFLPAG, the programmer must handle scrolling by
checking roll-up or roll-down indicators and filling subfile
appropriately.
32.) Explain the following DDS keywords:
a.) SFLEND
Controls the display of plus sign.
b.) SFLNXTCHG
Controls modified data tag on subfile records.
c.) SFLRCDNBR
Controls what subfile page is displayed and where cursor goes.
d.) SFLDROP
Controls when a subfile fold area is displayed.
33.) How do you clear a subfile?
Set the indicator associated with the SFLCLR keyword to ON and WRITE the subfile
control format.
34.) What are the 3 types of subfiles?
Single page, expandable and load-all.
35.) Which type of subfile has the better performance?
Single page.
36.) What is a subfile control record?
The record that controls the display of the record format and text information.
37.) What is a subfile record number?
The internal value associated with the each subfile record.
38.) How are roll keys handled by the program and in the system?
a.) Using ROLLUP and ROLLDOWN keyword indicators, or
Miscellaneous:
93.) What is QTEMP?
A unique temporary library associated with each job. It is deleted at the end of a job.
94.) What is the purpose of level checking?
To ensure that the version of a file used by a program has not changed since the
program was compiled.
95.) What two CL commands are usually used to debug a program?
STRDBG and ADDBKP - Start Dedub abd Add Breakpoint.
96.) What is QCMDEXC?
A program that can be called from an RPG program to execute most CL commands.
97.) What is the purpose of the CHKOBJ command?
To test for the existence of and object and to check for object authorization for the user.
2.
(a)
3.
What is the command used to find all logical files based on one physical file?
a) DSPDBR
b) DSPOBJD
c) DSPPFM
d) a and b
(a)
4.
(b)
d)
None
5.
6.
7.
(b)
8.
(b)
9.
(a)
10.
Which of the following files can be used in the TOFILE parameter of CPYF?
a) Logical file
b) Join Logical file
c) Tape file
d) None of the above
11.
(a)
12. What is the command used to see the messages in message file?
(b)
a)
b)
c)
d)
CRTMSGF
DSPMSGF
WRKMSGF
None
(a)
14.
15.
Write a program to add records in physical file from first member to second member without using
CPYF statement and find the record number difference if any.
21. Can a CL use Subfile?(MSGSFL)
22. How many record formats can you specify for a display file in a CL program?
DCLF command description:
20.
41.
42.
43.
The End Request (ENDRQS) command ends (cancels) a previously requested operation (command). One common use of the End Request
(ENDRQS) command is to cancel a request that is currently stopped at a breakpoint. This command function is also available as an option on
the System Request menu.
SFLMSGKEY
SFLPGMQ
SFLMSGRCD
53.
We will give SFLPGMQ value as 10 or 276. Explain in which cases these values will be used.
The field name and the SFLPGMQ keyword and parameters are the only DDS you can specify for this field.
If the name of the program message queue placed in this field at processing time is less than the field length (10 or 276 bytes), it must
be left-adjusted and padded with blanks.
For Integrated Language Environment* (ILE*) programs using the 276-byte parameter value, the format of the field
data must be as follows:
The first 256 bytes contains the ILE call message queue name. The call message queue name is the same as the ILE procedure name.
The name must be left-adjusted and padded with blanks.
Bytes 257 through 266 will optionally contain the ILE module name. The name, when specified, must be left-adjusted and padded
with blanks. If no module name is provided, these bytes must be set to blanks.
Bytes 267 through 276 will optionally contain the name of the ILE bound program name. The name, when specified, must be leftadjusted and padded with blanks. If no bound program name is provided, these bytes must be set to blanks.
Notes:
1.
If a parameter value of 10 is used on SFLPGMQ and an ILE procedure name longer than 10 bytes is placed into this field at
processing time, the procedure name is truncated to 10 bytes. The results will be unpredictable.
2.
If a parameter value of 276 is used on SFLPGMQ and a program message queue name is placed into this field at processing
time, bytes 257 through 276 must be set to blanks. If these bytes are not blank, the system assumes that a call message queue
name has been given and will not find the specified program message queue.
If the SFLPGMQ keyword is specified on both the subfile and subfile control record, the SFLPGMQ parameter values must match.
However, different subfiles within the same file can use different SFLPGMQ parameter values.
This field is required on the subfile record format (identified by the SFL keyword) to build the subfile one message at a
time through multiple output operations to the subfile record format.
You can also specify this field on the subfile control record format (identified by the SFLCTL keyword) to build the
subfile all at once through a single output operation to the subfile control record. Specify option indicators with the
SFLINZ keyword to control the way the subfile is built.
Multiple output operation:
If you specify the field name and SFLPGMQ on the subfile record, you build the subfile one message at a time with
separate output operations to the subfile record format. For each output operation, the message reference key must be in
the first field of the record (SFLMSGKEY keyword), and the name of the program message queue must be in the
second field. At the time of the output operation, the OS/400 program retrieves the identified message from the queue
and places it in the subfile as a record.
Note:
A CL program cannot be used for a multiple output operation. The relative record number required each time a message is built is not
supported for CL.
Which Function key is used to do step by step debugging? F10 (for STRDBG)
How you will find particular string/word ?
Which function key is used to add break points? F6
Which function key is used to remove break points?
How to display the value of a variable? F11
What is the command used to start the debug? STRDBG
How to run the program up to a particular point skipping in between statements? F12
How to change the value of a variable?
How to enter a system command?
How do you start source debugger?
Which keyword will effect the messages to come at particular line on the screen?
Two objects with same name and type cannot exist in different libraries. (F)
Not all commands typed on command line are CL commands . (F)
A CL command can be an IBM or user defined command. (T)
DCLF is used to declare a display or database file in CL. (T)
All variables in the file being declared gets implicitly defined in the CL program. (T)
CL command is a statement that requests the system to perform a function. (T)
The built-in menu called MAJOR organizes all the AS/400 commands. (T)
RCVF reads a record from a display or data base file. (T)
SNDF writes a record to a display or a data base file. (F)
OVRDBF is used to qualify the library where the file is located. (T)
The submit job command is used to submit a job to a job queue for interactive processing. (F)
A message subfile is a repository of all the predefined messages. (F)
A library is an object used to group related objects. (T)
The declare commands (DCL & DCLF) must precede all other CL statements. (T)
A CL program can contain only CL commands. (T)
Program variables are stored in libraries. (F)
The value of a CL variable can be changed using CHGVAR. (T)
The CHGVAR command can be used to retrieve and to change the LDA. (T)
The current library cannot be a duplicate of any library in the library list. (F)
We should not create a library with a name that begins with Q. (T)
*CHANGE (change authority) allows the user to access the objects in the library. (T)
The two types of files that are supported in CL programs are display and data base files. (T)
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
A break-handling program is called whenever a message of high severity arrives on the message
queue. (T)
Program message queues are used to send messages between program calls of a job. (T)
A program message queue for a program is no longer available for use when the program ends. (T)
CHKOBJ checks the object authority. (F)
The duplicate object created using CRTDUPOBJ has the same object type as the original object.
(T)
Any object can be renamed if we have the object management authority for the object and update
and read authority for the library containing the object. (T)
CHGDTAARA command changes only a part of the value of a specified data area. (F)
CPROBJ command compresses selected objects in order to save disk space on the system. (T)
Display and print files only can be compressed using CPROBJ. (T)
The user part of the library list contains those libraries referred to by the systems users and
applications. (T)
OPNQRYF acts as a filter between a high-level language program and display files. (F)
A high-level language program must share the open data path created by the OPNQRYF. (T)
The KEYFLD parameter causes OPNQRYF to create the open data path in an ordered sequence.
(T)
A maximum of 50 key fields can be specified in KEYFLD parameter of OPNQRYF. (T)
The QRYSLT parameter of OPNQRYF is used to restrict the records to which a high-level
language program has access. (T)
OPNQRYF supports relational, logical, arithmetic and string operators. (T)
A FORMAT file is a physical file that contains no data, but exists only for the benefit of
OPNQRYF. (T)
OVRDBF command can dynamically join files. (F)
Random processing is not supported for unique key or group processing using OPNQRYF. (T)
The POSDBF command positions the file pointer of an open query file to the beginning or end of a file
(F)
The CL command RTVMBRD retrieves the description of a specific object. (F)
The DSPPGM command displays the attributes of a program. (T)
RTVCLSRC recreates the CL source of a CL program, whose source has been deleted. (T)
PARM parameter is used to pass parameters using either CALL or TFRCTL commands. (T)
To start debug mode, STRDBG command cannot be used. (F)
DSPDBG command is used to display the debugging program. (F)
IBMS DB2
Introduction
DB2 is the relational database system that runs in an MVS environment. It was developed
by IBM and interfaces with SQL. With the use of SQL, DB2, databases can be accessed
by wide range of host languages. SQL is the relational database application language
that interfaces with DB2. Because of its capabilities, SQL and , in turn, DB2 have gained
considerable acceptance. Thus, a working knowledge of DB2 increases ones
marketability. The questions and answers that follow are intended for those with working
knowledge of DB2 as a self-test. If you need to brush up, the nearest book store is your
next step.
Q:
A:
Q:
What is an alias?
A:
It is an alternate name that can be used in SQL statements to refer to a table or
view in the same or a remote DB2 subsystem.
Q:
Q:
Q:
Q:
Q:
Q:
Q:
A:
Q:
Q:
Q:
Q:
Q:
A:
Q:
Q:
A:
Q:
Q:
Q:
Q:
Q:
A:
Q:
Q:
Q:
Q:
will be executed, inserting this information into the X PLAN TABLE where X is the
authorization id of the owner of the plan.
Q:
Q:
Q:
A:
Q:
Q:
Q:
Q:
Q:
Q:
A:
When an entire index (or a portion thereof) is scanned to locate rows, we call this
an index scan. This type of access can be used, for example, to select all rows of a table
in some order and avoid a sort for a query.
Q:
Q:
What is a join?
A:
A join is a relational operation that allows retrieval of data from two or more tables
based on matching column values.
Q:
Q:
Q:
Q:
What is an object?
A:
An object is anything that is managed by DB2 (that is, databases, tablespaces,
tables, views, indexes or synonyms), but not the data itself.
Q:
Q:
What is a page?
A:
This is the unit of storage within a tablespace or index space that is accessed by
DB2.
Q:
what is a pagespace?
A:
Pagespace refers either to an unpartitioned table, to an index space or to a single
partition of a partitioned table of index space.
Q:
What is a predicate?
A:
A predicate is an element of a search condition that expresses or implies a
comparison operation.
Q:
Q:
A:
Q:
A:
Q:
Q:
Q:
What is meant by repeatable read?
A: When an application program executes with repeatable read protection, rows referenced by the
program cannot be changed by other program until the program reaches a commit point.
Q:
What is a row?
A: A row is a single occurrence of the columns(of data) described by the table definition.
Q:
Q:
Q:
Q:
A:
What is a tablespace?
A tablespace is a VSAM dataset, which is used to store one or more tables. The physical
page can consist of 4k or 32k pages.
Q:
How would you move a tablespace (using STOGROUP) to a different DASD volume
allocated to that tablespace?
A:
1. If the tablespace used is only allocated to the STOGROUP:
ALTER STOGROUP add volume (new) delete volume(old)
REORG TABLESPACE or RECOVER TABLESPACE
2. Create a new stogroup that points to the new volume. ALTER the tablespace and
REORG or RECOVER the tablespace.
Q:
A:
This is a seven-part value that consists of a date (yymmdd) and time (hhmmss and
microseconds).
Q:
A:
Q:
A:
This is a sequence of operations within a unit of work (i.e., work done between
commit points).
Q:
What is a view?
A:
A view is an alternative representation of data contained in one or more tables. A
view can include all or some of the columns contained in the table or tables.
Q:
A:
Q:
A:
Q:
A:
Q:
Can DASD types assigned to storage groups to be intermixed (i.e., 330s and
3380s)?
A:
NO.
Q:
Q:
What are the three types of page locks that can be held?
A:
Exclusive, update, and share.
Q:
Can TSO users access DB2? If yes, which command is used to invoke DB2.
A:
TSO users can invoke DB2 by using the DSN RUN command.
Q:
A:
Q:
Q:
A:
Q:
Catalogs
Q:
A:
The DB2 catalog is a set of tables that contain information about all of the DB2
objects (tables, views, plans, etc).
Q:
A:
Q:
In which column of which DB2 catalog would you find the length of the rows for all
tables?
In the RECLENGTH column of SYSIBM.SYSTABLES.
What information is held in SYSIBM.SYSCOPY?
A:
The SYSIBM.SYSCOPY table contains information about image copies made of
the tablespace.
Q:
A:
Included is the name of the database, the tablespace name, and the image copy type
(full, incremental, etc.,) as well as the date and time each copy was made.
Q:
A:
The SYSIBM.SYSLINKS table contains information about the links between
tables created by referential constraints.
Q:
Where would you find information about the type of database authority held by a
user?
A:
SYSIBM.SYSDBAUTH.
Q:
Where could you look if you had a question about whether a column has been
defined as an index?
A:
Q:
Once you create a view, where would information about the view be stored?
A:
When a view is created, system information about the view is stored in
SYSIBM.SYSVIEWS.
UTILITIES
Q:
A:
The copy utility will create an image copy of a tablespace or a dataset within a
tablespace. There are two types of image copies : full and incremental. A full image copy
copies all pages in a tablespace or dataset. An incremental image copy copies only pages
that have been modified since the last use of the COPY utility.
Q:
A:
The LOAD utility will load data into one or more tables in a tablespace or
partition. The LOAD can also replace the contents of a single partition or of an entire
tablespace.
Q:
A:
It can merge several incremental copies of a tablespace to make a single
incremental copy and it can merge incremental copies with a full-image copy to make a
new full-image copy.
Q:
A:
This utility recovers data to the current state or a previous state. The largest unit of
data recovery is the tablespace; the smallest is a page. Data is recovered from image
copies of a tablespace and database log change records.
Q:
A:
It will reorganize a tablespace to improve access performance and reorganize
indexes so that they are more efficiently clustered.
Q:
A:
It will repair invalid data with valid data and / or reset status conditions. The data
may be your own data or data you would not normally access; space amp pages and index
entries.
Q:
A:
RUNSTATS will scan tablespaces and indexes gathering information about
utilization of space and efficiency of indexes. The information is stored in the DB2
catalog and is used by the SQL optimizer to select access paths to data during the bind.
Q:
A:
This utility updates DB2 catalog columns that tell how much space is allocated for
storage groups ,related tablespace and indexes.
Q:
While the copy pending flag is on, is the tablespace that was just recovered
available for use?
A:
Question Bank
1. How many Types of jobs there are present on as/400.
Ans: - 5 jobs
1. Prestart
2. Interactive
3. Batch
4. Auto start
5. Communication
2. How many sub-files can be declared in an RPG.
Ans :- 24
3. How many data-structure can be declared in an RPG.
Ans :- 32763
4. At What specs we define the data area, data structures etc in case of RPG. Is it E specs or I
specs.
Ans:- I
5. What is the function of these keywords in an Sub file Program SFLFOLD & SFLDROP, are
they totally opposite.
Ans:6. Which OPCODE to use in RPG for showing compilers to go to O specs
Ans:7. DOW & DOU (Difference).
Ans:8. OVRDBF for what purpose.
Ans:9. Return & TFRCTL (main usage).
Ans:10. Sub file option for what purpose.
Data Right
*READ
*ADD
*UPD
*DLT
*EXECUT
*
26. Can we generate the error message at any other place rather than on 24th line.
Ans :- MSGLOC keyword is used to define where we want to show the message line
27. TYPE of Array.
Ans: - Three types of Arrays are there
1. Run-time array.
2. Compile time Array.
3. Pre-run time array
28. How to retrieve the user information in case of a RPGLE Program.
Ans:29. Which command to be used for backup purpose
Ans:30. How to search an element from an array (which OPCODE to use).
Ans:31. At which position we should define the indicator In different cases, e.g., what will happen if we
define an indicator at LO position in case of a SETLL OPCODE.
Ans:32. If we will not use the index with the array variable, what would happen
Ans:33. How to define a table in an RPG.
Ans:34. How many user classes are there
Ans: - There are five user classes
*SECOFR
*SECADM
*PGMR
*SYSOPR
*USER
35. About group-profile, can we define one group profile in another group profile
Ans:36. What would happen if we use two OVRDBF Command in CLP?
51. Difference between LF & Open Query which one is dynamic & which one static.
Ans :52. What do you mean by PEP.
Ans :53. Type of Data Structures.
Ans:54. Can we retrieve the name of user from RPG
Ans:55. How to call a program in batch mode from another program.
Ans:56. Multi-member files.
1. How many members can a file have?
2. How to generate a report based on all the member of a file.
3. If we created a logical file how many members can a logical file have?
4. On join operation in logical file (How many files can be joined).
Ans:- 1. depending upon the user, if he has mentioned *maxval at the time of compiling then no
limit.
57. If we will use two OVRDBF command in CL program what will happen.
Ans:- nothing, it will rename the previous file with a new name.
58. Function of MONMSG where we have to use these commands can we use this command
anywhere in a program.
Ans:- yes.
59. If you change any of your program on my particular date after some date you want to view how
many changes & what changes you have made to your source program how can you find it.
Ans:60. Different method by which you can pass parameters from a program to another.
Ans:61. Question related to sub files & there usages of different key words like SFLDSP, SFLCTL,
SFLDLT, SFLCLR SFLENDD SFLNVTCHG
Ans:62. At what position on a screen can generate a message line.
Ans:-
The single-page subfile method is most suitable for displaying a large set of data
where you need both random access and the capacity to roll forward and backward
from the selected beginning point. Remember that your program must provide all
rolling function. Use single-page subfiles for highly random selection of data or
where field-level selection of subfile fields is a requirement.
67. Can we use multi-dimensional array if yes then how.
Ans:68. Can we change the sign on screen for any one subsystem, if yes how?
Ans:69. What is the usage of QTEMP library can we store any of our Physical file on QTEMP library.
Ans:70. Type of System values
Ans:71. How many files can be declared in one CL Program.
Ans:- 1 file only
72. How Many files can be declared in one RPG/400 program.
Ans:- 50 files only, no limit in RPGILE
73. How many libraries can be added in a job?
Ans:- In V5R2 it is 251.
74.
What RPG operation codes are associated with data areas?
75.
What operation code should be used to check for the existence of a
specific record in a keyed file?
76.
What is a compile-time table?
77.
What is a pre-execution table?
78.
How is data accessed from a table?
79.
How can indenting be utilized to make it easier to read a compiled
RPG program?
Ans :- By overriding the indent parameter in the CRTRPGPGM command
with a
character.
80.
What is a level checking error?
Ans :- When a HLL object isnt linked with the current DDS object.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
91.
92.
93.
122.
A file with key A is to be accessed randomly on the basis of a field B. Available options
Create a new logical, Opnqry with STRSEQ parameter having B, Sorting the file etc.
123. Where is the *INZSR subroutine coded.
124. When does a indicator defined in 73-74 position seton while chaining a record.
125. Except keyword. A file defined in F spec as O type and a DS defined in D spec. How can
the file be updated using the DS.
126. How to include a service program in your program.
127. While creating the program if *OWNER is given to the usrprf parameter what is its
significance.
128. Where is a prototype defined.
129. API for ovrdbf.
130. Difference b/w seton LR and Seton RT.
131. What is a Job ? What are the attributes Of a job ?
Ans :- A job is the basic unit of work on AS/400
The attributes are :
Job Number : Unique system generated sequential number
Job Name : Any user defined name (Max. 10 char)
User Name : Who initiated the job
132.
Total Marks : 50
Duration
: 1 Hr.
5. Display Files
1. True/False
2. Multiple
Choice
3. Fill-in the
blanks
4. Subjective
Tot
al
no.
of
Qns
.
Questions
from Topic
10
5
1 2 3 4 5
1 1 3 3 2
1 1 1 1 1
15
2 2 4 4 3
10
1 - 4 4 1
2.1
this
_____________ line command is used to copy a block of records to the targets and retain
command.
2.2
_____________ line command is used to copy a record n times immediately below this
record.
2.3
TABS is a ____________command .
2.4
Line command to shift the data in a block of records to left by n positions is ______________
2.5
Line command to shift the data in a block of records to right by n positions is _____________
2.6
HIDE is a ____________command.
2.7
Command line command to exit the edit session without saving the changes is _____________.
2.8
Command line command to save the changes and exit the edit session is ________________.
2.9
Command line command to save the changes and remain in the edit session is
_______________.
2.10
Command line command to shift data over when replacing a string during change operations
___.
2.11
Command line command to tailor the session defaults is ________________.
2.12
Line command to move 5 lines to the left by 10 positions __________________
3.1
3.2
3.3
3.4
3.5
3.6
4.5
5.1
4.1
4.2
4.3
4.4
True/False :
1.1
1.2
1.3
1.4
2.1
2.2
3.1
3.2
3.3
4.1
4.2
4.3
4.4
4.5
4.6
4.7
5.1
5.2
5.3
5.4
5.5
Join logical file may contain more than one record format.
Logical file contains Data.
CONCAT and SUBST keywords are valid for Logical Files only.
Key fields are required if UNIQUE key word is specified.
Logical file should have all the fields that are there in parent Physical File.
Physical Files cannot be updated through Join Logical File defined on them.
In Multiple Format Logical File separate PFILE keywords are required for each record.
C is used for Combined use of input and output of field in Display Files.
ERRMSG keyword in Display Files is used to display the system messages.
If COLOR keyword is given at record level it applies to the entire record.
DSPATR(MDT) will become *ON if Data moves from field
OVERLAY keyword is used to display the record format over the previous display.
Multiple-choice :
1.1
a.
2.1
b.
c. 5
a.
3.1
b. HIDE
c. EXCL
a.
3.2
b. ABSVAL
c. NOSIGN
a.
4.1
b. Logical File
a.
b. JFILE
c. JLFILE
4.2
a. File , Logical
b. Record , Logical
c. Field , PF
d. Field , LF
5.1
100
a.
b. 2024
c. 1024
d. 1000
5.2
DSPATR(PC)
a.
b. DSPATR(PR)
c. DSPPTR
The keywords that are used to specify the system name, date, time and user name are
5.3
a.
b.
c.
d.
5.4
a.
5.5
b. ?
c. -
DSPATR(PW)
b. DSPATR(ND)
c. DSPATR(PD)
Subjective :
How many layers are there in AS/400 Architecture. What are they.
1.1
3.1
R RMT0
FLD1
FLD2
5P 0
5P 0
LF1:
A
A
A
A
A
A
R RMT3
FLD1
FLD2
K *NONE
S FLD1
FLD2
PFILE(PF1)
COMP(EQ 2)
COMP(EQ 3)
3.1.1
LF2:
A
A
A
A
A
A
R RMT4
FLD1
FLD2
K *NONE
S FLD1
S FLD2
PFILE(PF1)
COMP(EQ 2)
COMP(EQ 3)
3.1.2
LF3:
A
A
A
A
A
R RMT5
FLD1
K *NONE
S FLD1
O
PFILE(PF1)
VALUES(2)
ALL
3.2.
R REC1
NAME
EMPNO
DESG
SAL
S SAL
K EMPNO
3.3
PFILE(PF1)
COMP(GT 5000)
RECPF
NAME
DESG
SAL
Data in PF
20A
10A
7S 2
JAIN
RAO
JAIN
SSE
15000
FACULTY 10000
VIKAS
SE
RAMARAO SE
9000
SHARMA OB
5000
LF : LFEMP
R
RECLF
NAME
SE
12000
16000
K
S
O
S
DESG
SAL
*NONE
NAME
SAL
DESG
COMP(EQ JAIN)
COMP(LE 12000)
COMP(EQ SE)
3.4
Write down the various file level access path key words.
3.5
3.6
In how many ways a record format in a Physical File can be specified. Explain.
4.1
4.2
4.3
4.4
5.1
What are the various Keywords used to define a Join Logical File. Explain.
What is the difference between CAnn key and CFnn key.
Total Marks : 50
Duration : 1 Hr.
Topics :
1. RPG Fundamentals
2. RPG Programming
3. Subfiles
4. Printer Files
Scheme of the Test Paper.
Section
Tot Question
al
no.
of
Qns
.
1.
True/False
2. Multiple
Choice
3. Fill-in the
blanks
4.
Subjective
s from
Topic
10
1 2 3 4
2 6 2 -
1 3 - 1
15
4 7 2 2
10
1 7 2 -
1.5
1.6
1.7
1.8
1.9
3.1
3.2
3.3
SFLDSP keyword must be activated only if there are records in the subfile. (T)
SFLRCDNBR is a mandatory keyword for Expand subfiles (T)
Subfiles are used just for displaying the records. (F)
3.4
3.5
4.1 _________ is the file-level keyword to remove option indicators from buffer and to
place them in a
99-byte separate indicator area. (INDARA)
4.2 _________ is the field-level keyword to specify the location of an unnamed, 4digit, zoned decimal
field to contain the page number. (PAGNBR)
4.3 _________ is the keyword to specify the printer to skip to a specific line number
after it
prints one or more lines. (SKIPA)
4.4 _________ is the keyword to specify the printer to space some no of lines after it
prints one or more
lines. (SPACEA)
4.5
RLU stands for __________________ (Report Layout Utility)
4.6
The significance of Overflow indicator in printer files is ____________ (Page break)
1.2
b. F-spec
c. C-spec
1.3
b. C-spec
c. I-spec
1.4
b. F-spec
c. C-spec
Primary
b. Full procedural
(b)
d. E-spec
(c)
d. E-spec
(a)
d. I-spec
(a)
c. Array
d. Output
1.5
2.1
d. Control
b. Pre-run time
(a)
c. Run time
d. Compile-run
b. 50
c. 1024
(d)
d. 200
2.4
c. I-spec
2.3
b. C-spec
2.2
(b)
b. EXSR
c. EXEC
(a)
d. None
(a)
c. CATCON
d. None
2.5 _____Opcode verifies that each character in the given string is from the given set of
characters. (a)
a. CHECK
2.6
d. None
b. DIVDE
c. DIVD
(a)
d. None
2.8
c. CHRCH
2.7
b. VERFY
b. CALL
c. FRECAL
(a)
d. None
To search for a particular element in an array or table _______ opcode is used (d)
a. LOOKP
b. LUKUP
c. LKUP
d. LOKUP
2.9
b. MUPLY
c. MULT
(c)
d. None
(b)
b. Data structures
c. Tables
d. None
b. READP
c. READC
d. None
b. SQR
c. SQTR
(c)
(a)
d. None
2.13 To find the difference between the values of two fields ______ opcode is used
(b)
a. SUBT
b. SUB
c. SUBTR
d. None
`2.14 UPDAT opcode can be used only when the file type (position 15 of F-spec)
contains (c)
a.I
4.1
a. I
II. Expand
b. II
d. C
(d)
III. Single-page
c. III
d. I & II
4.3
c. U
4.2
b. O
b. 1000
c. 2410
(a)
d. 2024
_________ is the keyword to specify that the printer device is to skip to a specific
line number
before it prints one or more lines.
(c)
a. SKIP
4.4
b. SPACEB
c. SKIPB
b. 132
d. None
(a)
c. 80
d. 738
Subjective questions.
1.1
1.2
1.3
How many kinds of specifications are there in RPG/400. What are they.
What is the purpose of various specifications of RPG/400.
Differentiate between Externally described files and Program-described files.
B contains
| p | a | b | c
|
b.
|1 |2 |3 |
B |1 |0|
op-code fact2 result
After executing DIV
A
B
B contains | ` | |
2.19 If an indicator, say 99 is to be set on, in how many ways you can do it. (write Cspecs)
2.20 What is the out put of KEY1, KEY2 and KEY3 in the following program ?
0000.01
C
0000.02
C
0000.03
C
0000.04
C
0001.00
C
0002.00
C
0003.0 0
C
C
C
C
C
C
C
C
C
C
A
B
C
Z-ADD1000
Z-ADD2000
MOVE '3000'
MOVE '4000'
MOVE A
MOVE D
DSPLY
DSPLY
DSPLY
SETON
A
B
C
D
C
B
40
40
4
4
LR
2.22 What is the output of $TMP1 and $TMP2 in the following program?
0002.00
0003.00
0004.00
0005.00
0007.00
0008.00
C
C
C
C
C
C
MOVEL*BLANKS
$TMP1 DSPLY
MOVEL*BLANKS
MOVEL'I'
'RMTP' CAT
$TMP2
$TMP2 DSPLY
$TMP1 8
$TMP2 5
$TMP2
$TMP2
0009.00
SETON
LR
2.23 What is the output of $PAY, $PAYC, $PAYD and $ARR,I in the following
program?
0001.01
E
0003.00 I
0004.00 I
0005.00 I
0006.00 I
0006.01
C
0006.02
C
0007.00
C
0009.00
C
0010.00
C
0010.01
C
0010.02
C
0011.00
C
0012.01
C
0012.02
C
0012.03
C
0013.0 3
C
$ARR
3 8
DS
1 10 $PAY
1 8 $PAYD
9 10 $PAYC
Z-ADD*ZEROS $VAL 80
MOVE 'ARRAY' $RSN 5
Z-ADD 0217199 $TEMP 82
MOVE $TEMP $PAY
$PAY DSPLY
$PAYD DSPLY
$PAYC DSPLY
MOVE *BLANKS $ARR
Z-ADD1
I
20
MOVE $RSN
$ARR,I
$ARR,I DSPLY
SETON
LR
3.1
C
C
C
C
C
C
C
SUM
Z-ADD5
Z-ADD0
DOWLE
ADD
ADD
ENDDO
DSPLY
A
30
SUM
50
100
I
SUM
15
I
How many types of Subfiles are there. What are they. Differentiate.
3.2 Explain about the keywords SFLCTL, SFLDSPCTL, SFLDSP.
3.3 What is the difference between the keywords SFLPAG and SFLSIZ.
3.4 What is the difference between the keywords SFLCLR and SFLINZ.
3.5 What is the advantage of SFLRCDNBR and SFLNXTCHG keywords.