11
CL/400 & RPG/400 1. How will you check whether a command as given error or not? By using the command MONMSG with suitable message identifier. 2. How many ways you can copy records? CPYF CRTDUPOBJ 3. In CL how to read a file? RCVF 4. In CL which command is equivalent to EXFMT? SNDRCVF 5. Difference between Interactive call and Batch call (SBMJOB). If case of Interactive call it is a sequential execution. Where as in case of SBMJOB if there are three programs called Eg: PGMA, PGMB and PGMC. Whether or not PGMA is ended PGMB and PGMC is called. 6. What is the difference between MOVE and EVAL Using MOVE we can move values from variable of one Data type to another. In case of EVAL both the variable types should be of same type.MOVE just moves value from one variable to another. But EVAL first initializes the variable and then it moves the values. 7 By what all ways we can insert values in a file? CPYF STRDFU In STRSQL by using INSERT statement 8. By what all ways we can view records in a file? STRDFU RUNQRY command

RPG Questions and Synon

Embed Size (px)

Citation preview

Page 1: RPG Questions and Synon

CL/400 & RPG/400

1. How will you check whether a command as given error or not?

By using the command MONMSG with suitable message identifier.

2. How many ways you can copy records?

CPYF

CRTDUPOBJ

3. In CL how to read a file?

RCVF

4. In CL which command is equivalent to EXFMT?

SNDRCVF

5. Difference between Interactive call and Batch call (SBMJOB).

If case of Interactive call it is a sequential execution. Where as in case of

SBMJOB if there are three programs called Eg: PGMA, PGMB and PGMC.

Whether or not PGMA is ended PGMB and PGMC is called.

6. What is the difference between MOVE and EVAL

Using MOVE we can move values from variable of one Data type to another. In

case of EVAL both the variable types should be of same type.MOVE just moves

value from one variable to another. But EVAL first initializes the variable and

then it moves the values.

7 By what all ways we can insert values in a file?

CPYF

STRDFU

In STRSQL by using INSERT statement

8. By what all ways we can view records in a file?

STRDFU

RUNQRY command

Page 2: RPG Questions and Synon

DSPPFM

DSPF

In STRSQL by using SELECT statement

9. How to find fields associated for a particular file?

Using DSPFFD (Display File Field Description)

10. What is the CL Command to find all the logical files associated for a particular

physical file?

DSPDBR

11. What is the use of DSPPGMREF?

The Display Program References (DSPPGMREF) command provides a list of the

system objects referred to by the specified programs.

12. What is use of SETLL, SETGT, READ, READE, READP, REDPE, CHAIN?

SETLL:

It will Position the pointer in a file equal to or greater than the value specified in

FACTOR1 field.

SETGT:

It will Position the pointer in a file greater than the value specified in FACTOR1

field.

READ:

It will read the records sequentially in a file. Mainly used in sequential file.

READE:

It will read the equal records, based on the value specified in FACTOR1 field.

READP:

It will read the prior records, sequentially in a file.

REDPE:

Page 3: RPG Questions and Synon

It will read prior equal records, based on the value specified in the FACTOR1

field.

CHAIN:

It is used in Indexed file. It’s Equivalent to STELL & READE. First it will

Position the record in the file and then it will read the specific record.

13. What is difference between DOW and DOU?

DOU will execute at least one time, control will enter into the loop and only after

that it will check for the condition. But in case of DOW it will first check the

condition, only when the condition is true it will enter the DO loop.

14. What is the difference between LEAVE and ITER?

LEAVE:

Quits the loop and the control will be transfered to the statement following the

ENDDO statement.

ITER:

It quits that particular iteration and control goes back to the DO statement

15. How will you eliminate leading and trailing blanks for a string.

Using %trim

16. How will you Debug when an application is running in a production environment.

a. If the job is already running, using WRKACTJOB first we need to hold

the job. (or) If the job is not running then while submitting include this

parameter

SBMJOB CALL (PGMA) HLD (*YES)

b. Note the Job Number, Job Name & User.

c. Issue STRSRVJOB with the Job Number, Job Name & User.

d. STRDBG

e. Release the job.

f. Start Debugging.

g. ENDDBG

Page 4: RPG Questions and Synon

h. ENDSRVJOB

17. When will you go for a multiple occurrence data structure

If we want multiple – Dimensional Array

18. While declaring what is the following meant for

S - Standalone field

DS - Data Structure

PR – Prototype

PI – Procedure interface

C – Constant

Blanks - specification does not define a data structure, a constant, a standalone

field, an array, or a table.

19. How to view all the PF in a Library?

Using WRKF command. Specify the file attribute as PF and give the required

Library.

If only PF-DTA Then wrkobjpdm command

20. Why do you use EXCEPT Keyword in RPG?

The EXCPT has two major functions v.i.z

It allows records to be written during calculations time. It allows a variable

number of records to be written in a program i.e at either detail calculation or total

calculation time.

21. Usage of DSPOBJD.

The Display Object Description (DSPOBJD) command displays the names

and attributes of specified objects in the specified library or in the libraries of the

job's library list. The command can also display the names and attributes of

libraries themselves, if specified.

22. Usage of WRKJOBD

The Work with Job Descriptions (WRKJOBD) command shows a list of job

descriptions and allows you to change, copy, delete, and display specified job

descriptions.

23. How do you create a series of PF say starting with "AB1",”AB2”,…and so on ?

Page 5: RPG Questions and Synon

24. Which opcode writes record and reads ?

EXFMT.

24. When would you not use *INLR?

When the entire file operations are handled by the RPG CYCLE.

25. Difference between *INLR and RETURN.

*INLR closes all files used and removes the call stack entry.

RETURN passes control to the called program. Call stack entry is not removed.

26. Steps that has to be followed for writing Sub files.

27. Steps that has to be followed for implementing Commitment control.

- See end of docs.

28. Usage of CHGPF. – If you have pf which contains data, you want add one more

filed that time you can use this command.

29. Select Opcode Syntax : The SELEC operation appears on a line to identify the

start of a case construct. The SELEC is followed by one or more WHXX lines,

each of which specifies a condition to be tested ; each WHXX is followed by one

or more calculations to be performed when that condition is met. ENDSL signaled

for end of operation.

- SELEC

- X WHXX 1

- Z –add X

- Y WH yy 2

- Z –add y

- ENDSL

30. Usage of *INZSR and *PSSR.

It is first executable routine in a RPG Pgm. Essentially all variables & Data

structures, Array definitions get initialized in this routine.

PSSR is the default Exception/Error handler for RPG Programs. We

can also define our own *PSSR routines in the PGM.

30. How do u display records from a particular page in Subfiles? SFLRCDNBR

31. Usage of *LIKE with DEFINE.

Page 6: RPG Questions and Synon

This coding techniques eliminates the need to constantly change the programming

code when database fields are changed .When the program is recompiled, the new

field definitions will automatically be applied to the program work fields .

C * LIKE DEFN DTAFLD WRKFLD

SYNON

1. Types of File relations?

Defined as

Owned by

Refers to

Extended by

Includes

2. Types of file to field relation?

Known by

Qualified by

Has

3. How many types of file are available in synon/2e?

Reference file (Master file)

Capture file (Transaction file)

Structure file (Field reference file)

4. Types of Accesspath

Physical, Update, Retrieval, Resequence, Query, Span.

5. Built in Functions available in Synon

*ADD, *COMMIT, *COMPUTE, *MOVE, *MULT, *QUIT, *DIV, *CONCAT,

*SUBSTRING

etc.,

5. Types of Objects in Synon

CRT, CHG, DLT, SLTRCD, EDTRCD

6. Virtual Field

Page 7: RPG Questions and Synon

It is logically present in many files but physically present only in one file.

7. If you want to avoid system performance Degradation due to Virutalization. What

will you do?

Transaction file might contain many Virtual fields. So while opening the transaction

file it might take sometime, as all the records in the virtual field as to be dumped into the

transaction file. So we need to minimize the use of Virtual field.

8. In Data Modeling what is the effect when we give *None or *All for Sharing.

When we give *All for Sharing - If same fields exists in both the files. Declaring the

fields and its attributes in one file is enough.

When we give *None for Sharing - If same fields exists in both the files. Declaring

the fields in one file is enough. But attributes as to be defined separately

9. What will happen when you hide, drop a field?

Drop – Field is not used.

Hide – Field is not visible to the user. We can access at any point of time.

10. Type of EDTRCD

Edit record (1 screen)

Edit record (2 screen)

Edit record (3 screen)

11. What is Assimilation?

Process of retrieving existing externally described OS/400 file definitions into

SYNON/2E design model.

The Command is YRTVPFMDL

12. What is differentiation?

The process in data-modeling of creating new entities by splitting a current entity into

two separate entities.

13. What are the functions created by default for a REF file

CHGOBJ, CRTOBJ, DLTOBJ, EDTFIL & SELRCD

14. Difference between EXCEXTFUN and EXCINTFUN

Page 8: RPG Questions and Synon

Execute external functions � allows to specify a high level program using an action

diagram.

Implemented as separate program and has its own action diagram. Parameter of VRY is

allowed.

Execute internal functions� allows to specify a portion of an action diagram for repeated

use in other functions.

15. Does a RTVOBJ have to be coded before a DLTOBJ

No

16. Does an EDTFIL automatically read the database file it is built over?

Yes

17. Does a PMTRCD automatically read the database file it is built over?

No

18. Difference between EDTTRN and EDTFIL

EDTTRN – Loads an entire subfile.

EDTFIL - Only loads one page of a subfile at a time.

19. Name the Access paths which are created automatically for every REF or CPT file

Physical Access path

Update Access path

Retrieval Access path

20. What are two ways to define a Select/Omit access path? Explain.

Dynamic – Selection is not build into AS/400 path,is applied at run time.Dynamic

selection is less ifficient than statis selection .,but may help to reduce the number of

OS/400 access path s that are required.

Static(S) – Selection is build into access path .

-

21. What does ICF do on an action diagram line?

Insert a case statement and prompt.

22. What are the roles a parameter can take

RST, POS, MAP, VRY

23. What are different types of context

DB Context: DB1 & DB2

Page 9: RPG Questions and Synon

Device contexts: CTL, RCD, DTL, 2ND, 3RD, CUR, NXT, KEY

System contexts: JOB, PGM

Program contexts: PAR, WRK

Literal contexts: CON, CND

24. What is RTVMSG?

The RTVMSG function returns a message to the calling program. Using the message

text we can perform any number of process such as moving a character string from a

database file into a field.

25. What is EXCMSG?

This function specifies that a request message is to be executed. The request may be

any CL, OS/2 or Unix command.

26. Various data types available in Synon/2E

CDE, NBR, PCT, REF, STS, TXT, VAL, VNM, DTE, NAR, QTY, TME, IGC,

SGT, PRC

27. Object types in Synon

File, Relation, Condition, Function & Access path

28. How will you Submit a Batch job in Synon

Using EXCMSG

29. Various message functions available

EXCMSG, RTVMSG, SNDCMPMSG, SNDERRMSG, SNDINFMSG,

SNDSTSMSG

30. 6 Forms of an Output variable. –ADD,MULT,DIV,SUB

31. How do u submit batch jobs in Synon apart from EXCMSG?

32. How to display a status field next to a status field?-

- By using RTVCND Declare function field next to status field / declare out put function

field retrive command ot get the description value.

33. How do you delete access path?

Page 10: RPG Questions and Synon

We can not delete a access path which is referred by some other function/accesspath.

If you want to delete, you have to remove the (REF) relations then delete.

38.

How do you handle level check error ?

- Again compile pf with *level check-No or compile program.

39.

Explain use of EXSR ,EXCPT,ROLBK

40.

EVAL HNO = % trim(% subst (address :1:4))

41.

List Various access path maintaince

Immediate- Update changes immediately

Delay- changes are logged and the access path updates when the file is opened .No

rebuild is done.

Rebuild- Access path is rebuild when the file is opened again.

42.Why would you want to define a parameter as *Neither ?

- 1.For use as work variable within function.

- 2.In a chgobj, field passed as neither are not updated in the

database

- 3.In screen functions ,Neither Map parameters can be used to

create O/P fields on the device design (Thus avoiding the need to

create function fields)

43. How can you pass more than 9 parameter to a function ?

- By using Array.

44. what is Diff between a PRTFIL & PRTOGJ ?

-PRTFIL is an external function which specifies a complete report.

-PRTOBJ is an internal function type which specifies a segment of report for inclusion

within another report function .

45. Which access path needed for PRTFIL and PRTOBJ

-QRY access path.

46. What are constructs ?

Constructs are the basic building blocks of an action diagram .By combining different

types of constructs we define the procedural logic of an action diagram.The combination

constructs are : sequence, Conditional and interactive.

47.How is Commitment control implemented in synon?

Page 11: RPG Questions and Synon

- It can be implemented by specifying one of the following three

options in function options.

- MASTER : By choosing this option the program will run under

commitment control .This program will contain appropriate

- commit points,which will be defined in the synon supplied

program Y2BGCTL .

- SLAVE : The program will run under commitment control .No

automatic start or commit points are included.Commit points can

be added using commit build in function.

- * NONE : The program does not run under commitment

control.Hence ther are no commit points .(Physical files running

under Commitment control must be journalized)