You are on page 1of 10

Write a callable procedure that is able to return a value that capitalizes the f irst letter of any word or phrase

that is passed to it as a parameter, this proc edure should be written so that it could be bound into any program or service pr ogram.

// define any hspecs here h Nomain h *------------------------------------------------------------------------* * Program Details * @company * @author * @date * @chgReport * @chgAction * @description * : : : : : :

*------------------------------------------------------------------------* * Prototypes *------------------------------------------------------------------------*

*------------------------------------------------------------------------* * @procName * @procAuthor * @procDate : uppercase1st : Praphul Agarwal : 8 December 2011

* @procDescription : capitalize 1st letter of each word in String; *@procCode:--------------------------------------------------------------* // define prototype for procedure here allow for any size parameter // to be procedure and returned upto maximum of 32739 characters

d uppercase1st d String *; S

pr 255A

*------------------------------------------------------------------------* * Global variables and constants *

*------------------------------------------------------------------------* // define any global variables and parameters here d up d lo d String d C C S 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' 255A

*------------------------------------------------------------------------* * @procName * @procAuthor * @procDate : uppercase1st : :

* @procDescription : capitalize 1st letter of each word in String; *@procCode:--------------------------------------------------------------* // define procedure interface and keywords required to make this // callable from an external program. P uppercase1st d uppercase1st d String *; B pi S 255A Export

*------------------------------------------------------------------------* * local variables and constants *

*------------------------------------------------------------------------*

// define local variable here d d d d locString S x nonblankpos S blankpos S /free locString = String; If( locString = ' ') ; RetString = ' ' ; else ; nonblankpos = %check('':locstring:nonblankpos); locstring = %xlate(lo:up:locstring) locstring = %xlate(up:lo:locstring:nonblankpos+1) blankpos = nonblankpos +1 dow blankpos <> 0; blankpos = %check(lo:locstring:blankpos); locstring = %xlate(lo:up:locstring:blankpos+1) locstring = %xlate(up:lo:locstring:blankpos+2) enddo; 255A S 5s 0 5s 0 inz(1) 5s 0

Return locstring ;

/end-free P E

1.1What is special about the QTEMP library? Ans: It is created by the system, No user control over creation and deletion. It is Job specific library. It is created by the system for each Job. No other Job can access other Job's QTEMP.

1.2 What is the purpose of the QRPLOBJ library? Ans:It archives the object if the object is compiled while it is being used.

1.3 What is a file level identifier and what is its purpose? Ans: File level indicators are used for File operations such as READ,READE, CHAI N,SETLL. These are HI, LO, EQ (Positions are 71-76).

1.4 Which of the following commands can only be used in debug mode?

ADDBKP

ADDTRC

DSPFFD

DSPPGM

DSPPGMVAR

ENDDBG

STRDBG

Ans:ENDDBG.

1.5 Which command shows which jobs have locks applied to a file? Ans: WRKOBJLCK

1.6 List two commands that can be used transfer a file between two AS/400's? Ans:FTP and TELNET. .

1.7 What record format field mapping options would you use with the CPYF command to copy data from an existing file to an updated layout of the same file? Ans *MAP and *DROP.

RPG IV Questions

2.1 What is the purposes of the H, N and P operation extenders (that can be spec ified in parenthesis after the operation code)? Ans: H is for Half Adjusted, N is for Read without lock, P is for padded with bl anks.

2.2 What is the difference between the DOU and DOW operation codes? Ans: DOW first checks the condition mentioned at the loop and then executes foll owing code in the loop if condition is true. DOU executes loop at least once.

2.3 What is the difference between the ITER and LEAVE operation codes? Ans: ITER takes the control at the ENDDO statement and loop execute again. LEAVE takes control after the ENDDO statement.

2.4 What is the difference between the CLEAR and RESET operation codes? Ans:

2.5 What other two operation codes (other than ENDSL or END) are used in conjunc tion with SELECT? Ans: WHEN or WHENXX where XX are EQ, LE,GE,LT,GT.

2.6 Which operation code is a combination of a write followed by a read of a rec ord format of a workstation file? Ans:.EXFMT.

2.7 Which of the following operation codes can be used with a subfile?

CHAIN

READ

READC

READE

READP

READPE

Ans: CHAIN, READ,READC.

2.8 When doing a CHAIN, READ, READE or REDPE on a file that has been opened in u pdate mode, how would you handle the record being locked by another job? Ans: By specifying N opcode extender.

2.9 What is the most efficient way of checking for the existence of a record wit hout actually reading the record into memory? Ans: SETLL or INFDBS.

2.10 How would you make sure that files are closed when a called program ends?

Ans: By viewing Call Stack. WRKJOB command and option 10.

2.11 What is the name of the subroutine that can be run at program initializatio n time? Ans: *INZSR.

DDS Questions

3.1 What is the difference between CAnn (Command Attention) and CFnn (Command Fu nction) function keys? Ans: CAnn is Command Attention Key and CFnn is Command Function Key. CAnn return s the response only but CFnn returns data as well response.

3.2 What is the effect of the field-level keyword SFLRCDNBR(CURSOR)? Ans: It displays the subfile with the record no. moved in SFLRCDNBR as first rec ord.

3.3 What is the purpose of the record-level keyword SFLCSRRRN?

Ans: It returns the position of the cursor on subfile where it is located.

3.4 What is the purpose of the record-level keyword SFLNXTCHG? Ans: It is used to set MDT *ON explicitly, to read the next changed record.

3.5 What is the purpose of the record-level keyword SFLINZ? (a) Sets all records in the subfile to their initial values. (b)Clears the subfile of all records. (c) Deletes the subfile.

Ans: A.

ILE Questions

4.1 What is the purpose of the command CVTRPGSRC? Ans: To convert RPGIII source to ILE RPG source.

4.3 What ILE RPG/400 operation code performs a call to a bound procedure? Ans:CALLB.

4.4 What are the four ways to handle exceptions in an ILE RPG Program? Ans: *PSSR,*INFSR, MON-ENDMON block,Opcode Extender E.

Thanks, Praphul Agarwal

You might also like