as400_qa_2 dasa rpg

21
1 AS/ 400 Machine Q 101 What is the advantage of layered machine architecture of AS/400? Ans : This unique machine architecture allows applications to be protected from any hardware changes, both processor upgrades, and attachment of new devices. Q 102 What is the storage management technique used by the AS/400 system? Ans : Virtual storage technique. As/400 system implement their Virtual storage scheme through a concept called the SINGLE LEVEL STORAGE. This term simply means that in AS/400 systems, no distinction is made between disk storage and main storage. All storage appears to be one homogeneous sea of main storage accessed exactly in the same way. Q 103 a) What is the size of Virtual storage supported by AS/400 ? Ans : 281 terabytes.(over 281 trillion unique addresses) b) How many address lines are needed for that ? Ans : 2 to the power of N = 281 trillion bytes There fore N = 48 So 48 address lines are needed. Q 104 What is the advantage of Object orientation in AS/400? Ans : Object orientation makes users independent of the implementation techniques and addressing structure used in the machine. Objects are created in a standard format using a created instruction. Once the object is created its internal format is not apparent to the user. This process is known as DATA ENCAPSULATION. Q 105 Give any four advanced characteristics of AS/400 ? Ans : 1. Layered machine architecture 2. Object orientation 3. Single level storage 4. Integrated data base 5. C-level security 6. SAA (Strategic Systems Application Architecture) Q 106 What is the library order in which the search is done for an object ? Qs AND As ON AS /400

Upload: raju

Post on 14-Dec-2015

233 views

Category:

Documents


2 download

DESCRIPTION

this is system application 400

TRANSCRIPT

Page 1: AS400_QA_2  dasa rpg

1 AS/ 400 Machine

Q 101 What is the advantage of layered machine architecture of AS/400?

Ans : This unique machine architecture allows applications to be protected from any hardware changes, both processor upgrades, and attachment of new devices.

Q 102 What is the storage management technique used by the AS/400 system?

Ans : Virtual storage technique. As/400 system implement their Virtual storage scheme through a concept called the SINGLE LEVEL STORAGE. This term simply means that in AS/400 systems, no distinction is made between disk storage and main storage. All storage appears to be one homogeneous sea of main storage accessed exactly in the same way.

Q 103 a) What is the size of Virtual storage supported by AS/400 ?

Ans : 281 terabytes.(over 281 trillion unique addresses)

b) How many address lines are needed for that ?

Ans : 2 to the power of N = 281 trillion bytes There fore N = 48 So 48 address lines are needed.

Q 104 What is the advantage of Object orientation in AS/400?

Ans : Object orientation makes users independent of the implementation techniques and addressing structure used in the machine. Objects are created in a standard format using a created instruction. Once the object is created its internal format is not apparent to the user. This process is known as DATA ENCAPSULATION.

Q 105 Give any four advanced characteristics of AS/400 ?

Ans : 1. Layered machine architecture 2. Object orientation 3. Single level storage 4. Integrated data base 5. C-level security 6. SAA (Strategic Systems Application Architecture)

Q 106 What is the library order in which the search is done for an object ?Answer: The search order is as follows: System libraries, Product libraries, Current library, User library list.

Q 107 What are the subsystem configurations supplied by IBM ?Answer: The subsystems supplied by IBM are as follows:

QINTER : Runs all interactive jobsQBATCH : Runs all batch jobsQCTL : Only used by system operator, controls the systemQSPL : Runs all print jobsQCMN : Runs all communication jobs.

Qs AND As ON

AS /400

Page 2: AS400_QA_2  dasa rpg

2 RPG / ILERPG / SQLRPG

Q 201 List various specifications

as used in RPG ?

Ans H Spec : Control SpecificationGives information about program generation and running.Like Page No, Line , Date format, Debug, Currency Symbol,

Date Edit etc., F Spec : File SpecificationDefines all files used in the program.( A Max. of 50 files can be declared

in RPG with a max. of 8 Printer files. Only one record address type file can be declared pre RPG program )

E Spec : Extension specification Defines Record address file, Array, Table etc., ( A max. of 200 arrays can

be defined)

L Spec : Line contour specification Used for program described PRINTER files to define the No of lines and

form to print on a page. I Spec : Input specification For program described Input files, fields within a record, data within a

field, control fields etc., C Spec : Calculation specification Indicates operations to be done on Data. The order is, 1. Detail Calculation 2. Total Calculation 3. Subroutines

O Spec : Output specifications Describes the record and the format of fields in a program described

output file and when the record is to be written.

Q 202 What are the three different types of arrays used in RPG?/* ref.-RPG/400 reference 403 */

Ans 1. The RUN-TIME array is loaded by the program while it is running.

2. The COMPILE-TIME array is loaded when the program is created. Then itbecomes the permanent part of the program.

3. The PRERUN-TIME array is loaded from an array file when the program begins running, before any input, calculation, or output operations are processed.

Q 203 How many Record Address Files can be specified in a RPG program?/* ref.-RPG/400 reference 457*/

Ans Only one

Q 204 What is multiple occurrence data structure.?

Page 3: AS400_QA_2  dasa rpg

Ans A multiple occurrence data structure is a data structure whose definition is repeated in a program to form a series of data structures with identical formats. All occurrences of data structure have the same attributes and can be referred to individually.

Q 205 What are different lock states of data areas in RPG/400?

Ans An IN operation with *LOCK specified has an exclusive allow read (*EXCLRD) lock state

* An IN operation without *LOCK specified has a shared for read (*SHRRD) lock state while transferring data. When the transfer is complete, RPG/400 program releases the lock.

* An OUT operation has an exclusive (*EXCL) lock state during the transfer of

data and then lock state is released. The RPG/400 program then releases the exclusive allow read (*EXCLRD) lock state established by the IN operation.

Q 206 List some important OPCODES in RPG .

Ans OPCODE FUNCTIONCASxx Conditionally evokes a subroutineCHECK Checks if each character in the source string is among the valid

characters indicated in Factor 1CHECKR Checks the above condition from right*LIKE Defines a field based upon the attributes of another field

Factor 2 - Name of the field being referencedResult - Name of the field

FEOD Forced end of dataFORCE Only for primary and secondary files.

Factor 2 contains the name of the file from which the next record is to be retrieved.

FREE Deactivates a program*NAMVAR, IN Retrieves data areaLOKUP To search an arrayMOVEA Move an arrayMVR Move remainder to result fieldOCCUR Retrieve Data structure ( Multiple occurrence)OUT Write to data area and exitPOST Returns information in INFDS data structureRESET Sets elements in a structure ( Record format, DS, array, Table

etc., ) to its initial value. SHTDN Informs the user if the system operator has given a Shutdown.

OPCODE FUNCTIONSORTA Sort an array ( Ascending / Descending)SQRT Square rootSUBST Substring of a field is picked upTAG Defines Label Comes with GO TO and CABxxTESTB Test Bit . Identifies the FAC 2 with the corresponding bits in field

name as result field.TESTN Test NumericTESTZ Tests if a field is a character field.UNLCK Unlocks a data area or releases a record.XFOOT Gives the sum of the elements in an arrayXLATE Factor 2 is translated as per the Table name in factor 1

Q 207 What is the maximum No. of nested loops that you can have in RPG ? Ans : 50

Page 4: AS400_QA_2  dasa rpg

3 CLP and System Commands

Q 301 What is CL? What are the advantages of using CL ? Answer: CL stand for Control Language. It is the primary interface to the operating system and can

be used at the same time by users at different workstations. The advantages are:

1. Because the commands are compiled and stored in a form that can be run immediately, using CL programs is faster than entering and running the commands individually.

2. Consistent processing of the same commands and logic.

3. Some functions require CL commands that cannot be entered individually and must be part of a CL program.

4. CL programs can be tested and debugged like other HLL programs.

5. Parameters can be passed to CL programs to adapt the operations performed by the program to the particular requirements of that use.

Q 302 What is a MONMSG command? What is its use ?Answer: The MONMSG command is used to monitor the error messages generated during the execution of a program and take necessary action.

Q 303 What are the different Override commands ?Answer: OVRDBF, OVRTAPF, OVRDSPF, OVPRTF, OVRDKTF

Q 304 Can a CL use Subfile ?Answer: Only MSGSFL can be used

Q 305 How to find the number of record in the object ? Ans : DSPFD <Lib> / < Obj>

Q 306 How to find the number of members in an object ? Ans : DSPFD <Obj> TYPE <*mbrlist>

Q 307 How to find the Field description of an object ? DSPFFD , DSPOBJD

Q 308 How to access all the members in a PF ?Ans : Use OVRDBF with the member option *ALL

Q 309 What is the function of DSPDBR ? Ans : Display Database Relations. To display a list of all Logical files based on a Physical file.

Q 310 What is the function of command FNDSTRPDM ? Ans : Searches for member or file for a particular string.

Q 311 What is the function of command DSPPGMREF? Ans : Displays list of all the files / programs referred by a program.

Q 312 What is the function of command RCLRSC ? It is Reclaim Recources command. It frees the static storage and the unused ODPs.

Q 313 Which command related to Data Area can not be used on the command line ? RTVDTAARA. Retrieve Data Area. Because we need to specify a return varible that receives the retun value. Hence this command can be used only in CL and not on command line.

Page 5: AS400_QA_2  dasa rpg

4 DDS / DISPLAY FILES / COMMAND / PRINTER FILES / RLU / HELP

Q401 How many record formats can a Physical File / Logical File have ?

Ans A Physical file can have only one record format whereas a Logical file can have multiple record formats.

Q 402 Define OMIT / SELECT with reference to a LF . Ans : They are used to omit or select record based on a criteria. O or S is defined in position 17

and the criteria is specified in function space. S FIELD COMP ( FIELD > 500)

Q 403 How to add members to a PF object ? Ans : ADDPFM <Obj> / <Mbr>

Q 404 Define various forms of Normalization. First form of Normalization : At least One key field should be defined which controls other fields

Second form of Normalization : In case of a compound key, any non key field should be dependent on the complete KEY.

Third form of Normalization : A Non key field should not be dependent on any other non key field.

Q 405 What are various spec types as applicable to DDS ?

SpecificationType/ Name

Meaning Applicable To

R Specifies a Record Format name ALL Blank Specifies a Field Name ALL K Specifies a Key Field PF & LF S Select Feld LF O Omit Field LF J Join Join LF H Help spec DSPF only

Q 406 What are join logical files and what are their advantages ? How many maximum Physical Files can we join ?Answer: Join logical files are special case of logical files wherein we can select fields from different

Physical files having some relation. A maximum of 32 physical files can be joined in a join logical file.

Q 407 What is a message file ? How is it advantageous ?Answer: A message file is used to store application related messages. It consists of two parts, the

Message Id and the Message Description. The advantage is that a standard list can be maintained and called wherever necessary.

Q 408 List various data types that can be used to define a field ?

Entry MeaningA CharacterP Packed DecimalS Zoned DecimalB BinaryF Floating pointH HexadecimalL DateT TimeZ Timestamp

* AS /400 system performs arithmatic operations more efficiently for packed decimal than for zoned decimal.

Page 6: AS400_QA_2  dasa rpg

Q 409 What do you mean by an access path ? An access path describes the order in which the records have to be retrieved.

Q410 What are various access paths as applicable to PF and LF? For a PF We can have, a. Arrival sequence access path b. Keyed sequence access path. For a LF we can have, a. Arrival sequence path b. Keyed sequence path c. Select and Omit criteria Q 411 What is Arrival sequence access path ? It is based on the order in which the records arrive and are stored in the file. An externally described file has an arrival sequence path when no key fields are sopecified. It is the only processing method that allows a program to use the storage space previously occupied by a deleted record by placing another record in the deletd space. An arrival sequence access path does not take any additional storage and is always saved or restored with the file.

Q 412 What do you understand by Keyed Sequence Access Path ? A keyed sequence accesss path is based on the contents of thekey fields as defined in DDS .

Q 413 How are Character and Numeric key fields arrenged ? Character key fields are arrenged based on the sequence defined for

EBCDIC characters. They can also be defined based on an alternating collating sequence.( Keyword ALTSEQ in DDS ) Key fields defined as numeric are arrenged based on their algebric values, unless ABSVAL or UNSIGNED are specified for it.

Q 414 What is significance of Keyword UNIQUE ? This File leve keyword is used to prevent a duplicate Key value.

By specifying this keyword a record can not be entered or copied into a file if its key value is the same as that of a record already existing in a file. *INCNULL parameter of UNIQUE doesn’t allow duplication of even blanks.whereas *EXCNULL doesn’t check if duplication exists in the form of blank values.

Q 415 If a duplicate key value is allowed then how would the system store data ?

In this case we can specify that records with duplicate key values are stored in the access path in one of the following ways :

a. Last in first out (LIFO) b. First in first out (FIFO) c. first changed first out (FCFO)

Q 416 Can we use an already existing access path ? How ? Yes. We can use DDS keyword REFACCPTH to use another files access

path. This keyword, however, can not be used with the join logical files.

Q 417 Describe various ways of creating a database file ? The system supports various ways of creating a database file ; a. OS /400 IDDU ( Interactive Data Definition Utility ) b. SQL / 400 : It is a IBM System Application Architecture (SAA) relational

database language. c OS/ 400 Control Language ; You can use CL command CRTPF or CRTLF

or CRTSRCPF.

Q 418 What do you do if you have store data in a perticular palace in auxillary storage ?

System by default automatically finds a place to store data. However if you wish to specify which disk you want the file located on, specify the UNIT parameter while creating file. In case there is not sufficient space in the UNIT you have specified then the data is stored in some other unit and an information message is flashed.

Page 7: AS400_QA_2  dasa rpg

Q 419 What is the significance of parameter FRCRATIO ? Normally the system decides when to write changed data from main storage

to Auxiliary storage. if you want to control when database changes are written to auxiliary storage, you can do so using FRCRATIO on either the create, change, or override database commands.

Q 420 What do you undestand by parameter FRCACCPTH ? This parameter controls when the access path is written to auxiliary storage.

Q 421 What do you understand by parameter LVLCHK ?This is a default parameter that checks the level compatiblity of the file when any program tries to open it. In case of mismatch of level an error message is delivered.

Q 422 What are various ways of maintening an access path ? Why do we need to maintain access path ?While a file is open, the system mainains the acccess path as changes are made to the database file.Because more than one access path can exist for the same data, changin data in one file might cause changes to be made in access paths for other files that are not currently open.

The type of access path maintainance can be specified on MAINT parameter.Three ways of access path maintenance are :A. IMMEDIATE : It means that the access path is maintened as changes are made to its associated data, regardless if the file is open.

B. REBUILD : Means that the access path is maintained only when the file is open and not when the file is closed. The access [path is rebuilt when the file uis opened the next time.C. DELAYED : means that any maintenance for the access path is done after the file member is opened the next time and while it remains open. Delayed maintainance can be faster than REBUILD but if the collected changes exceed approx. 25 % of the # of entries in the access path the changes are no longer accumulated and the sytem rebuilds the access path at the next open.

Comparison ChartIMMEDIATE REBUILD DELAYEDFast open because the access path is current

Slow open as the access path must be rebuild

Moderately fast. Access path need not be build but must be changed.

Slower update/ Output operations as the sys. must maintain the access path immediately during these operations.

Faster Update / Output operations

Moderately fast Update / output operations

Q 423 How do you recover access path if the system fails ?Use RECOVER parameter while creating a file. On this parameter specify that the access path should be REBUILD.

Q 424 What are WAITFILE and WAITRCD parameters while creating a file ?When you create a file, you can specify how long a program should wait for either file or record in the file if anothe job has it locked . If the wait time ends before the file or record is released then an error message is sent.

Q 425 How do oy specify public authority while creating a file ?Use AUT parameter.

Q 426 Define some important keywords as related to LF . a. SST ` : To specify which fields are in substring.

b. RENAME : To rename a PF field in logical file.c. TRNTBL : To define translation table for a field. The value in PF will be

translated as specified in the translation table while readin LF.

Page 8: AS400_QA_2  dasa rpg

d. DYNSLT : Dynamic select or omit. Only records whch meet Slect or Omit criteria are picked up by logical . Its a file level keyword

e. CONCAT : Concats fields of PF to get a new field.

5 SUBFILES

Q 501 What is the maximum number of Subfile Records in a Subfile ?Answer: 9999

Q 502 What is a Message Subfile ?Answer: A message subfile is a special type of subfile which is used to send messages to the workstations. It has the facility to store multiple messages so that the user can go and check for the list.

Q 503 Can a CL use Subfile ?Answer: Only MSGSFL can be used

Q 504 What is a relative record number in subfiles?Answer: It is used as a subfile record pointer. Using this one can position to any record

in the subfile.

Q 505 What are different types of subfiles ? They can be divided as a. Equal subfile - Subfile size = Subfile page b. Unequal Subfile - Subfile size > Subfile page 1. All Load Type - Loads all the record from file Both pageup & pagedown controlled by system. 2. Expanding type - Loads subfile page by page Pageup is taken care by system but the user should take care of pagedown.

They can also be divided as : a. Vertical Subfile - Displays records vertically b. Horizontal Subfile - Displays records horizontally. i.e. More than one record in one line.

Q 506 What are the advantages of using a subfile ? A subfile is used to display multiple records on the screen. 1. We can process multiple records from the screen thereby the productivity and simplicity are improved. 2 . Ease of modifying.

3. It simulates Arrays and data stuctures. In case of arrays and data structures the length has to be defined beforehand. This limitation does not apply to subfiles.

Q 507 Describe the basic subfile structure ? A subfile issencially consists of two parts : 1. Subfile control format: It defines the header of the subfile. 2. Subfile record format : It is a file that resides in memory. It holds the subfile records which reside in yhe memory with the job. It also defines the record layout of the subfile. Q 508 What are the keywords mandatory to define a subfile ? The mandatory keywords are : 1. SFLCTL - To specify subfile control format 2. SFLDSPCTL - To display subfile records 3. SFLDSP - To display the subfile format domain 4. SFLPAG - Usualluy but not always the # of records to be displayed on the screen. 5. SFLSIZ

Page 9: AS400_QA_2  dasa rpg

Q 509 List some other important keywords related to a subfile ? 1. SFLINZ - Allows to activate the # of records specified on the keyword 2. SFLRNA - record not active 3. SFLNXTCHG - To flag a subfile record as changed, and if the program displays it again, not to lose the attribute. 4. SFLMODE - is 0 if not SFLDROP is 1 if SFLDROP 5. SFLCSRPRG - Subfile cursor position To control what field the cursor should be positioned to. ( To progress down a field )

6. SFLRCDNBR - To display the [page that contins the record having specified sufile record number.(RRN) 7. SFLENTER - Makes the ENTER key act as rollup key. SFLENTER (CF11) makes F11 key act as enter key. 8 SFLROLVAL - Subfile roll value . The ability to control the # of records to be rolled. (Less than SFLPAG ) 9 SFLCSRRRN - Subfile cursor relative record Number. Returns the RRN of the subfile record on which the cursor is positioned. 10. SFLLIN - gives the spce between records in case of a horizontal subfile.11. SFLFOLD - To define a horizontal subfile 12. SFLDROP To define a vertical subfile.

Q 510 What is the max. # of windows that can be activated at a time ? Ans :

12

6 QRY AND SQL

Q 601 What are CORRELATION NAMES ?

SELECT EMPNO, LASTNAME, USER1/TDEPT.DEPTNO, DEPTNAMEFROM USER1/TEMPL X, USER1/TDEPT YWHERE JOBCODE>59AND SEX = ‘F’AND X.DEPTNO = Y.DEPTNO

Where ‘X’ and ‘Y’ are called correlation names.

Notes on View

The following restrictions apply for VIEWS

* Can not change, insert, or delete data in a view if it includes any of the following

-- A FROM clause that uses more than one table(a join)-- The FROM clause that identifies a read-only view.-- Any of the SQL column functions(SUM, MAX, MIN, AVG or COUNT)-- Elimination of duplicate rows.-- Grouping(GROUP BY) or HAVING-- A subquery, such that the base object of the outer-most SELECT and a

table of a subquery are the same table.

In the above case, we can get data from views by means of SQL SELECT statement, but statements such as INSERT, UPDATE or DELETE can not be used.

* You can not INSERT a row in a view if:

Page 10: AS400_QA_2  dasa rpg

-- The table on which the view is based has a column for which there is no default value, and that column is not in the view.

-- The view has a column resulting from an expression, a constant, or a function, and the column has been specified in the INSERT column list.

* You can not update a column of a view that results from an expression, a constant, or a function.

* You can not use the special register USER.* You can not use UNION, UNION ALL, FOR UPDATE OF, or ORDER BY in the

definition of a view.

Q 602 What is an INDEX ?An Index is used by the system for faster data retrieval. An Index must be created in an SQL collection but the tables or files the index is created over can reside either in a collection or library.

COMMENT ON statement is used to give comments to the view or table. Comments are stored in the REMARKS column in the SYSTABLES.

7 SYSTEM ADMINISTRATION

Q 701 what is C - level security? (or ) What is Minimal security, Pass word security & resource security ? (or) What are the security levels supported by the AS/400 system ?

Ans : Minimal security : No pass words are used and any user can perform any function. Password security : Pass words must be used, however any user can perform any function. Resource security : Pass words are required and users can be controlled relative to the

objects they use, change or delete.Q 702 What are the various user classes in AS/400?

Ans 1. System/Security Administrator 2. Security Officer 3. System Operator 4. Programmer 5. User

8 WORK MANAGEMENT

Q 801 what is the difference between Command Attention (CAnn) and Command Function (CFnn) keys?

Ans CAnn : These keys return only the indication of the function key pressed and not data(data on the screen).

CFnn : These keys cause all input data(given to the screen) to be returned along with the function key pressed.

Q 802 What are data areas ? What are their advantages ? Give an exampleAnswer: A Data Area is an object used to hold data for access by any job running on the system. A data area can be used whenever you need to store information of limited size, independent of the existence of programs or files. Typical uses of data areas are:

To provide an area (perhaps within each job’s QTEMP library) to pass information within a job

To provide a field that is easily and frequently changed to control references within a job, such as:

Supplying the next order number to be assigned Supplying next check number Supplying the next save/restore media volume to be used

Page 11: AS400_QA_2  dasa rpg

To provide a constant field for use in several jobs, such as tax rate or distribution list.

To provide limited access to larger process that requires the data area. A data area can be locked to a single user, thus preventing other users from processing at the same time.

Q 804 What are various types of data areas ?

General Data Area

LocalData Area

GroupData Area

Program Initialization Parameter (PIP)Data Area

Created By User System System SystemSize Variable

(1 - 2000)Fixed (1024 )

Fixed (512 )

Fixed (2000 )

Type Char/ Dec/ Logical

Char Char Char

No. Per job Variable One One OneReferred as *LDA *GDA

Q 805 What is the variable used for automatic numbering of the Pages, Where and How do you specify the same?Answer: This is done by specifying PAGE in the Output Spec without being specified elsewhere, it is assumed to be of length 4 with no decimal places.

Q 806 Is it possible to incorporate the command line facility into an user application? If so how is it done?Answer: Yes, it is possible. We can call QUSCMDLN to take us to the command line.

Q 807 What is a Subprogram ? What are relative pros and cons of using a subprogram ? It is a child program called by a main program. Adv : 1. You can have subprogram written in different languages which are called by one main

program. 2. If the code for a program becomes very large, It can be brokn into subprograms, thus the

maintenance of cod becomes easier. Drawbacks : 1. Program initialization time increases.

2. Incrased open and close of files that results in an additional ODP Q 808 What are various types of sharing on AS /400 ? 1. Data sharing 2. Record Format sharing 3. Access path sharing Q 809 What is PAG ? PAG is Process Access Group . They are temporary variables for each job started in different places.

Q 810 What is POOL ? There are four types of POOL 1. Machine / Storage pool - All the system codes are run 2. Interactive pool - For Interactive jobs 3. Base pool - For all sorts of jobs 4 Other reserved pools - Q 811 What do you mean by ACTIVITY LEVEL ? Activity level is the no. of jobs that be simulteneously run. e. g. Activty level 4 means that 4 jobs can be run simulteneously in machine.

Q 812 What is a Data Queue ? What are the commands related to it ? A Data queue is an object that is used for faster data transfer. It does not contain any data but only the data description. Related commands are :

Page 12: AS400_QA_2  dasa rpg

QSNDDTAQ - To send data to a data queue. QRCVDTAQ - To receive data from a data queue. Q 812 What is an asynchronous process ? It is a process that can be executed concurrently with a job. e.g Submitting a job in Batch.

EXCEPTION/ERROR HANDLING:

The RPG/400 compiler handles 2 types of errors: Program exception or errors and File exception or errors.Some examples of program exception or errors are divisible by zero, Invalid array index or SQRT of a negative number. Some examples of file exception or errors are undefined record type or a device error.

FILE EXCEPTION/ERROR HANDLING

FTRNFIL OF E K DISK KINFDS FILDS1F KINFSR ERRRTNFMSTFIL UF E K DISK KINFDS FILDS2F KINFSR MSTERRFAUDITFIL OF E K DISK

Three files are defined on the F-Spec. You want to control the program logic if an exception or error occurs on the TRNFIL or on the MSTFIL file. Therefore, a unique INFDS and a INFSR are defined for each File.

IFILDS1 DSI *FILE FIL1I *RECORD REC1I *OPCODE OP1I *STATUS STS1I *ROUTINE RTN1IFILDS2 DSI *FILE FIL2I *RECORD REC2I *OPCODE OP2I *STATUS STS2I *ROUTINE RN2

The location of the subfields in the file information data structures is defined by special keywords in positions 44 through 51. To access these predefined subfields, you must assign a name to each subfield in positions 53 through 58. If an exception or error occurs, you can test the information in the data structure to determine, for example,what exception or error occured(*STATUS) and on which operation it occured (*OPCODE). You can then use that information within the file exception/error subroutine to determine the action to take.

PROGRAM EXCEPTION/ERROR HANDLINGAn Indicator can be specified in positions 56 and 57 of the calculation specifications

for any Opcodes. This indicator is set on if an exception/error occurs during the processing of the specified file operation. The optional program ststus data structure is updated with exception/error information. You can determine the action to be taken by testing the indicator.

A program exception error subroutine can be specified. You enter *PSSR in factor1 of a BEGSR operation to specify this subroutine. Information regarding the program exception/error is made available through a program status data structure that is specified with an S in position 18 of the data structure

statement on the input specifications.

If the indicator or the *PSSR is not present, program exception/errors are handled by the default error handler.

Page 13: AS400_QA_2  dasa rpg

The location of the fields in the program status data structure is defined by special keywords or by predefined From and To positions. In order to access the subfields,

you assign a name to each subfield in positions 53 through 58.

*STATUS Five digit numeric field with zero decimal positions , that contains status code.

*ROUTINE Eight-position character field that contains the name of the RPG/400 routine in

which the exception/error occured.

*PARMS Three-digit numeric field that contains the name of the program in which this

program status data structure is specified.

*PROGRAM Ten-position character field that contains the name of the program in which this program

status data structure is specified.

9 JOURNALLING

Q901 What are JOURNALS ?

A journal and journal receiver are used to record changes to tables and viewsin the database. The journal and journal receiver are then used in processing SQL COMMIT and ROLLBACK statements.

Q 902 What are COLLECTION ?

A collection consists of a library, a journal, a catalog and a datadictionary.Tables, views, and system objects can be created, moved, or restored in anSQL collection. SQL tables, views, and indexes can only be created in intoan SQL collection, moved into an SQL collection or restored into an SQL collection. AS/400 logical files can not be placed in an SQL collection becausethey cannot be described in the data dictionary.

Q 903 What are CATALOGS ?

Catalog views only contain information about objects in one collection. The information in a catalog is about your SQL collection and its contents.The catalog describes every table, view, index, and file in the collection andincludes column defenitions.A catalog is automatically created when you create a collection. You cannotdrop or explicitly change the catalog.

Page 14: AS400_QA_2  dasa rpg

10 APPLICATION PROGRAMMER INTERFACE

Q 1001 List some important APIs with essential parameters. Ans :

Part I User space APIs

1) Create User Space QUSCRTUS Parameters : Qualified User space name Input Char (20)

Extended attribute Input Char (10)Initial size Input Bianary(4)Initial Value Input Char (1)Public Authority Input Char (10)Text description Input Char (50)

Optional (a)Replace Input Char (10)Error Code I / O Char ( * )

Optional (b)Domain Input Char (10)

2) Change User Space QUSCUSAT Parameters : Returned library name Output Char (10)

Qualified User space name Input Char (20)Attributes to change Input Char ( * )Error Code I / O Char ( * )

3) Retrieve user space QUSRTVUS Parameters : Qualified user space name Input Char (20)

Starting position Input Binary (4) Length of data Input Binary (4) Receiver variable Output Char ( * )

Optional Error code I / O Char ( * )

4) Delete user space QUSDLTUS Parameters : Qualified user space name Input Char (20) Error Code I / O Char ( * )

Part 2 User Queue APIs

User Queues are permanent objects with an object type *USRQ . They provide a way for one or more processes to communicate asynchronously.

1 Create User Queue QUSCRTUQ Parameters : Qualified User queue name Input Char (20)

Extended attribute Input Char (10)Queue type Input Char (1)Key length Input Binary (4)Max. Message size Input Binary (4)Initial # of messages Input Binary (4)Additional # of messages Input Binary (4)Public authority Input Char (10)Text description Input Char (50)

Optional (A)Replace Input Char (100Error Code I / O Char ( * )

Page 15: AS400_QA_2  dasa rpg

Optional (B) Domain Input Char (10)Pointers Input Char (10)

2 Delete User queues QUSDLTUQ Parameters : Qualified user queue name Input Char (20)

Error Code I / O Char ( * )

Part III Object APIs

1 List Objects API QUSLOBJIt lets you generate a list of object names and descriptiveinformation based on specified selection parameters. The QUSLOBJ API places the list in the specified user space . The generated list replaces any existing list in the user space. You can usec this API to ,a. List Objects in a libraryb. List Objects of a typec. Provide a backup analysu\is based on when the object was

last saved or updated.d. Provid source member and object analysis from source

member info. to verify that the current source was used to create the specified object.

Parameters : Qualified User space object Input Char (20) Format name Input Char (8)

OBJL 0100 to OBJL0700

Object & Library Name Input Char ( 20) Object type Input Char (10)

Optional Error code I / O Char ( * )

2 Change Object Description API QLICOBJDIt lets you change objrct information about the specified object.

Parameters : Returned lbrary name Output Char (10) Object and library name Input Char (20)

Object type Input Char (10) Changed Object information Input Char ( * )

Error code I / O Char ( * )

3 Rename object API QLIRNMO It renames an existing object to a new object name or a new library name or both, and optionally replaces the object . Parameters : From qualified object name Input Char (20)

Object type Input Char (10) To qualified object name Input Char (20) Replace object Input Char (1)

( 0 no, 1 yes) Error code I / O Char ( * )

4 Retrieve object description QUSROBJD Information similar to DSPOBJD can be retrieved. Parameters : Receiver variable Output Char ( * ) Length of receiver variable Input Binary (4) Format name Input Char (8)

OBJD01000 -Basic OBJD0200 - PDM OBJD0300 -Service info. OBJD0400 - Full Object and Library name Input Char (20) Object type Input Char (10)

Optional Error Code I / O Char ( * )

Page 16: AS400_QA_2  dasa rpg