0% found this document useful (0 votes)
108 views9 pages

AS400

This document provides information about AS400 systems including libraries, physical and logical files, commands, jobs, debugging steps, arrays, data structures, FTP, journaling, subfiles, cursors, and common interview questions. It discusses key AS400 concepts such as library organization, file structure including record formats and access paths, common commands used to work with files and libraries, and RPG programming elements like arrays and data structures. It also covers job submission and debugging, file transfer using FTP, database journaling, different types of subfiles, and answers frequently asked interview questions about decimal data errors and the *INLR opcode.

Uploaded by

lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views9 pages

AS400

This document provides information about AS400 systems including libraries, physical and logical files, commands, jobs, debugging steps, arrays, data structures, FTP, journaling, subfiles, cursors, and common interview questions. It discusses key AS400 concepts such as library organization, file structure including record formats and access paths, common commands used to work with files and libraries, and RPG programming elements like arrays and data structures. It also covers job submission and debugging, file transfer using FTP, database journaling, different types of subfiles, and answers frequently asked interview questions about decimal data errors and the *INLR opcode.

Uploaded by

lakshmi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

http://interviewquestionsanswers.

org/__Suppose-I-have-3-jobs-A-B-and-C-I-want-to-submit-B-after-
successful-completion-of-A-and-want-to-subm

http://as400qa.blogspot.com/2010/01/how-many-ways-you-can-copy-records-cpyf.html

AS400 – Application System

Library – 1) System library – IBM library. Eg: QSYS

2) User library – Created by user

3) Current Library – the library which is used during the work

4) Product library – when IBM product is used it is added to the library and removed
automatically.

Source Physical file – this will have the source of different types of objects.

Physical file:
1) File level entries – gives the information about the file.

Keywords used are

 Unique – a new record cannot be entered if that have the key value same as that of the existing
key value.
 FIFO – the duplicate records will be retrieved in First in first out order.
 LIFO – the duplicate records will be retrieved in Last in first out order.
 FCFO – the duplicate records will be retrieved in First changed first out order.
 REF – to specify the name of the file from which fields are taking definition.
2) Record format level entries
3) Field level entries
4) Key field level entries

Logical file:
This selects data dynamically. It refers to the data present in the physical file.

1) Non-join logical file – it can be single member/ multi member. DYNSLT keyword is used at file
level identifier in order to use select/omit condition in the logical file. DYNSLT occurs when the
program reads the file.
2) Join logical file –
 JFILE – files need to be joined
 JOIN – the order in which the files need to be joined
 JFLD – common field in both file
 JDUPSEQ – the field in which the duplicate data needs to be organized
 JREF – reference field of primary file

Command in AS400:
 CRTLIB
 DSPLIB – This will give the list of objects present in library and within this we can check each
objects size, journaling details.
 DSPLIBL – this will give the list of libraries. Here it will also show the type of that library.(whether
user or system, etc)
 EDTLIBL – to edit the library list order.
 ADDLIBLE – here we can directly specify whether to add our library. (whether first or last)
 CRTSRCPF
 DSPFD – this will have all the details regarding the source physical file. This will have details like
access path details, file level identifier, record level identifier, no. of records present, no. of
members present, etc.
 DSPFFD – this will have only the file level information like record format, number of fields,
record length.
 CRTPF
 CHGPF
 CHGPFM
 DSPPFM – we can see the data present in that member.
 ADDPFM
 RGZPFM – the data in the file is inserted sequentially. So when records in between is deleted,
then that spaces will be left un-used, until we use RGZPFM which re-organize the space.
 CHGLF
 ADDLFM
 DSPDBR – displays dependent member of the file.
 CPYF – the below operations can be done using this command.
1) The fields from one file will be copied to another file.
2) The to file can be created even during the copy operation.
3) We can even specify the condition while copying records. (We can specify that
data with emp no 1 to 3 alone should be copied to a new file)
4) Record format field mapping –
*MAP & *DROP – if the to-file have a field which is not present in from-file,
then these keywords are used to specify default values or null values to the
fields in to-file. Map and drop come together.
*NOCHK – if the record formats are not matching for from and to file, then just
to copy data from from-file to to-file without any regard to field types, we will
use this function.

 RTVMBRD – with this we can retrieve the details of a member. This also helps in retrieving the
record count of a file in CLLE.
 CPYFRMIMPF
 CPYTOIMPF – a file will be stored as a stream file which will have delimiter which can be
specified.

Level check error:


A level check error occurs when there is a change in the file and the file have level check as *YES, then if
the program in which this file is used is not recompiled.

CPYF Vs CRTDUPOBJ:
With the use of CPYF, we can even select data based on fields or RRN and even we can copy data
between files which do not have the same format. CRTDUPOBJ just create a duplicate version of the
from object as it is.

Access Path:
It describes the order in which record is to be read. It can be either permanent (logical or
physical file) or Temporary (OPNQRYF).

 Arrival sequence access path – based on the RRN number file will be read
 Keyed sequence access path – based on the contents in the key field. Three ways to maintain it.
When emp1 field is key field in file1 and file2. When a change is made to emp1 field in file 1
and during that time file2 is not open. In that case how the access path will be maintained:
1) *Immed – this will update the changes irrespective of the file2 being open or closed.
2) *Re-Build – this will wait until the file2 is being opened and once it is opened, the data
will be updated. The system will stop collecting the data if the file is closed.
3) *Delayed – this will wait until the next time when the file is opened and it should be
remains open. In this, the system will collect all the data in between the file being closed
and opened again and make the changes after it is being opened.

Arrays:
 Compile time array – the elements in the array is loaded before execution.
The keywords used are DIM – Dimension of the array
CTDATA – represents that it is Compile time array
PERRCD – no. of entries in one array record.

Eg: Darr1 S 3P 0 DIM(5) CTDATA PERRCD(1)

 Run time array – the value will be loaded during the run-time.
Eg: Darr1 S 3P 0 DIM(5)
 Pre-run time array – we will have array element in a separate file. This file should be declared in
F spec with T as File designation entry.
Eg: FFile1 IT F 5 DISK -------- 5 defines the length of the record. ie. col * size of 1 elmnt.
Darr1 S 3P 0 DIM(5) FROMFILE(FILE1) PERRCD(1)

Dim – row*col

Perrcd – col
RPGLE Opcodes:
XFOOT – to sum the array elements

SORTA – to sort the array elements

LOOKUP – to look for an element in the array

Data structure:
Structure of different data types.

1) Program described
2) Externally described
3) Multiple occurrence
4) Indicator
5) Data area
6) Program status
7) File information

Jobs:
System jobs – the system itself runs job to generate spool file

User jobs –

 Interactive jobs – it requires user to always be signed-in


 Batch jobs – the job runs even without the user
 Communication jobs – system to system communication. Eg-FTP
 Auto-start jobs – it starts by itself based on the time

Steps of a service debugging:


 SBMJOB with HOLD as *YES
 STRSRVJOB – give the details of the job here.
 STRDBG – The breakpoint cannot be set as the job is not active yet
 RLSJOBQ
 It will take to the next screen. Take F10 and give DSPMODSRC to view the source and now set
the break point.
 Once the debugging is done, ENDDBG and then ENDSRVJOB.
Activation group:
This allocates storage and binding activities when a program executes. ILE programs cannot run
without the activation groups.

 Default activation group


 ILE activation group

FTP steps:
To transfer data between two AS400 systems

1) FTP the remote system name


2) User
3) Pwd
4) Bin
5) Get library and save file name
6) quit

Journaling:
It is a process of recording activity.

Steps:

 CRTJRNRCV
 CRTJRN
 STRJRNPF

Types of subfile:
1) Load all subfile – SFLSIZ > SFLPAG
2) Single page – SFLSIZ = SFLPAG
3) Expandable

Cursor:
A temporary set created in the system when embedded SQL is used. It can hold more than one
rows but can only process one row at the time.

 Sequential cursor – defined without SCROLL keyword and each row is fetched only once.
 Scrollable cursor – defined with SCROLL keyword and rows can be fetched many times.

Interview Questions:
1) What is decimal data error
Decimal data error occurs when any junk data is moved to the numeric field. When we use
eval for the same, it will throw compilation error. If we use move then it shows decimal data
error.
2) What will happen if we don’t give *INLR in RPGLE
LR – Last Record. This just a way to tell the program that last line of the program have
reached and when i exit the program, it can close all the files.
When we write any code lines after *INLR, even then it will execute those lines.
If we don’t give *INLR in the program, it will not throw any error, instead program keeps running
infinite times without knowing when it should end.
On the other hand Return opcode will just return to the calling program without releasing any
files used. Any code after this function will not be processed.
3) What is the difference between %CHECK and %SCAN
%Scan – this will find the position of the string given in the first field is present in the second
field.
%Check – this will check the position of where the string in first field is not matching with the
second field.
Eg: fld1 = ‘abcdef’
%scan(‘bcd’:fld1) – o/p – 2
%check(‘bcd’:fld1) – o/p – 1
Here %check returns 1 bcoz, it will start checking for the string bcd in fld1. It will find in frst
position it’s a and it does not match with bcd. So it returns the first position which does not
match.
4) What is session device error
When we try to load empty subfile, when we try to load more than 9999 records for load all
subfile, the system throws session or device error.
5) Dynamic/Embedded SQL
Steps:
 Exec SQL
 Declare the cursor – Declare C1 cursor for SQL statement
 Open the cursor – Open C1
 Fetch the value – Fetch C1 into :fields to which data needs to be loaded
 Validating the SQL records – SQLCOD=0/100/negative
 Fetch the next record
 Close the cursor – Close C1
 End Exec
6) Difference between Move and Eval
Move – it just moves data from one variable to another irrespective of the data type.
Eval – it moves the data from one data type to another only when both are of same data
type. And this initializes the variable and then it moves the values.
7) Difference between CPYF and CRTDUPOBJ

With the use of CPYF, we can even select data based on fields or RRN and even we can copy
data between files which do not have the same format. CRTDUPOBJ just create a duplicate
version of the from object as it is.

8) Difference between OPNQRYF and OVRDBF


9) What is signature violation
Signature – it is a value that provides check for service programs to ensure whether the changes
made to the service program are in such a way where the programs using this can function
properly. It is created by the system when CRTSRVPGM With EXPORT(*ALL) is used. So the
signature changes when the list of exports for the service program changes.
When a program is called, it checked for the signature of the service program from which it is
being called and if it is different then signature violation error is thrown.
So to rectify this, we can either re-build all the programs that referenced the changed service
programs or to create a binder language to manage the service program signatures.
10) How to find total deleted record from a file

DSPFD

11) What are the 2 commands used to debug a program and one of the command can be used in
interactive debug alone
12) How to read file in CL
Declare – DCLF
Read – RCVF
SETLL – We can use OVRDBF to specify the position of the pointer
Write – RUNSQL

13) MONMSG CPF0000 and CPF9999


14) How to handle record lock
DSPRCDLCK
15) How to read file in reverse order
CLLE - you can read a physical file in descending order. You can first sort the physical file in
descending order through OPNQRYF using KEYFLD. This will sort your PF in descending
order based on your key field and then do the RCVF on this file.
But for this you first need to do OVRDBF on the file.
16) How to check dependent files for PF
DSPDBR – Display Database Relations
17) What is OPNID in CL

When we need to use multiple files in CL, then we declare the file with OPNID and use this
OPNID during reading the files.

18) How can we use SQL in CL


RUNSQL
19) Difference between Chain and Reade
Chain – this will do setll and reade together
Reade – just reads the record
20) Monitor message in CLLE and RPGLE
CLLE – MONMSG
RPGLE -
 An error indicator or an 'E' operation code extender handler(eg: SETLL(E), UPDATE(E))
 Monitor – On-Error
 An error subroutine handler - *PSSR
 A default exception handler
21) Join LF
22) If file a has 6 flds and file B has 5 flds how you will copy File A into File B 
23) What is READC and SFLNXTCHG
READC – this will read subfile records which is changed.
SFLNXTCHG – this is used to mark the records in a subfile as changed.
When a record is being changed the modified tag will be switched on and once it is read by
READC the modified tag is turned off. Hence we cannot read it for the second time. In that case
if we have SFLNXTCHG indicator then we can able to read the same record again.

24) Clear and Reset


Clear – this sets elements to its default value. Numeric values to zero and character values to
Blanks.
Reset - this sets the field to it first initialization value.
Eg: dcl var1 char(5) ‘hi’
Eval var1 = ‘hello’
Clear var1
Dsply var1 ------- output will be ‘ ‘
Reset var1
Dsply var1 ------- output will be ‘ hi ‘

25) Can we read a file in RPG without using SETLL, READ and CHAIN
Yes. We have multiple ways to do it.
 We can use pre-run time array.
 File information data structure
 Primary file as file designation
26) Difference between bind by copy and bind by reference
27) What is the importance of MAPFLD in OPNQRYF
28) Difference between ITER and DO
29) What is parsing
30) Scripting language
31) Impact analysis of a program
32) If prg a calls prg b and then prgm c in one activation group, and prg b calls prg c in another
activation group. In which activation group does prgm c runs first
33) How to display empty subfile
34) What is level check means
35) If a file has the data as below
 Shrey
 Shrey
 Shrey
 John
 John
 Kaviya
 Kaviya

Here, how to write a code in RPGLE where it only reads the file three times.

Ans: *LOVAL SETLL

READ

‘SHREY’ SETGT or *LOVAL SETGT

READ

JOHN SETGT

READ

You might also like