You are on page 1of 88

1

1. Advantages of ILE:

RPG IV is more readable Allows for greater application modularity with static binding which means there are fewer external calls. Enhances programmer productivity by allowing greater code re use Enhances mixed language support by allowing the binding ILE languages into a single program Builds a foundation for the future by moving closer to object oriented design , modular programming and code reuse Enhancements in RPGIV Mixed Case entry permitted Compiler is not case sensitive Compiler can translate mixed case to upper case. Character names allowed Full DDS length supported Columns available for suscripts Undescore allowed in names Blank lines allowed making it more readable Limit changes : Limit Changes Field names & Array Names Length of Character Variable No of Possible array elements No of Possible Subroutines No of Decimal Positions No of files per program RPGIII 6 256 9999 256 9 50 RPGIV 10 32767 32767 No Limit 30 No Limit

H spec : Completely free format Additional functions: Date and Time Format Enhanced Readability F-Spec: Part of F-spec are now keyword based No of files un limited File definition checks have been relaxed File names length increased to 10 characters and record lengths to 5 digits D-Spec: Defining the data structures

2
Defining arrays Defining standalone fields Indent field names to show structures Easily define arrays within data structures Use keywords to make your code more readable and more flexible Keywords used in the D-Spec: INZ OCCURS OVERLAY EXTNAME EXTFLD PREFIX DIM ASCEND/DESCEND PERRCD FROMFILE/TOFILE EXFMT ALT CTDATA C-Spec: RPGIII BITOF CHEKR COMIT DEFN DELET EXCPT LOKUP OCCUR REDPE RETRN SELEC SETOF UPDAT UNLCK WHXX RPGIV BITOFF CHECKR COMMIT DEFINE DELETE EXCEPT LOOKUP OCCUR READPE RETURN SELECT SETOFF UPDATE UNLOCK WHENXX

Factor1,Factor2 & Result each increased to 14 characters Extended Factor2 allows free-format expressions Field length increased to 5 positions Decimal Positions increased to 2. Many opcodes increased to 6 characters Space for opcodes plus extenders increased to 10 characters New opcodes and operators added with extended factor 2 Conditioning indicators reduced to 1 from 3 O-Spec: No major changes in the O specification Names on the O spec have been expanded Skip Before/After and Space Before/After allow 3 positions New Opcodes:

have also been extended , to

3
ADDDUR CALLB CALLP DOU DOW EVAL EXTRCT IF SUBDUR TEST WHEN RPGIV supports date,time and timestamp data types With date , time and timestamp fields you can Calculate durations Extract portions of dates and times Move data from one field to another Compare their values Test for valid values The data types supported are D for Date T for Time Z for Timestamp The internal format can be specified on the H spec for all fields or on the D spec for specific fields With the introduction of the ADDDUR & SUBDUR opcodes you can easily add or subtract duration b/n date,time or timestamp fields. The EXTRCT opcode easily extracts a logical portion of a date ,time or timestamp field. The MOVE or MOVEL opcode can be used to easily move data to and from date,time & timestamp fields. You can compare dates, times& timestamps & test the validity of these fields using the TEST opcode. EXPRESSIONS: More precise results using expressions RPGIV is easier to read and maintain as it handles half adjustments & avoids usage of temporary variables Three type of expressions :Arithmetical, conditional and string Expressions are entered in the Extended calculation. Precedence rules apply to the evaluation of expressions. Expressions use DOU,DOW,IF,WHEN&EVAL opcodes. SUBPROCEDURES & PROTOTYPES: A subprocedure is a procedure specified after the main section.

4

It can only be called using a bound call . Subprocedure do not use the RPG cycle while running . All subporocedures have a corresponding prototype in the D-spec which ensures proper procedure or program call with correct parameters . Subprocedure without a main procedure is called a Nomain module. You can pass parameters to a subprocedure. Names defined in the subprocedure are not visible outside the subprocedure. You can call subprocedures recursively. Advanced Functions in RPGIV: RPGIV provides you with many advanced functions that make your code easier to maintain . It Provides you with powerful built-in functions that allows you to code more powerful and self-maintaining applications. TRIM BIF allows you to trim spaces from the beginning or end of a character variable. SUBST allows you to take a substring of a field. SIZE allows you to dynamically determine in size of a field,array or data structure. ELEM returns the number of elements in an array,table or multioccurance data structure. Based variables with pointers allow you to access information stored inside or outside your program. Modules can be bound together and data can be shared across modules using the IMPORT and EXPORT keywords . Using ILE allows you to take advantage or modular programming : ILE enables modular programming through seperately compiled pieces of code called modules. These modules are statistically bound. They are created using CRTxxxMOD command. OPM program runs in the default activation group . You can create an RPGIV program that is OPM compatible by using CRTBNDRPG with DFTACTGRP(*YES) There are two ways to create an ILE program.you can create bound RPG program using CRTBNDRPG Command or create a program binding modules together.

5
You can create a service program to handle frequently used routines & for better performance. Built-in-Functions: %ADDR %ELEM %PADDR %SIZE %SUBST %TRIM %TRIML %TRIMR Built-in Functions enables to : Trim spaces from character fields Refer to substring of a field Return the size of a field Return the number of elements in an array or multi-occurance data structure. Place the address of an item in a pointer Place the address of a procedure in a pointer variable Other advance functions include: Pointers to base storage inside or outside your program Data items using keywords that can be shared between bound modules. Activation group: An Activation group is a substructure of a job. It consists of system resources allocated to one or more programs running in it. It is a type of firewall that you can build around your application to protect its resources. ILE activation groups have many benefits over the default activation group: Protection of shared resources from other applications. Resources such as shared open data paths for files, can be shared among all programs in activation group, while being protected from other programs running in the same job . Scoping(Restricting) of file overrides and commitment control scope. Easily cleanup of a group of programs. You can clean up active programs and open files with in an activation group using the RCLACTGRP command.Other active programs running in the same job will not be affected. 2. Questions and Answers 1. Can a LDA be deleted.

6
We can’t delete *LDA 2. How will u see all the files that r used in a RPG program. DSPPGMREF 3. which of these OS are not supported by AS400 a.win2000, b.winNT, c.palm2000, d.Lotus notes, e.Unix. Palm 2000 4. what is DBCS. Double byte Character set 5. what is DSPDBR. It identifies physical and logical files that are dependent to particular files. 6. How would u find the source of the object. By service pgm wrkobj description *service 7. How to retrieve the source for the object. If CL – RTVCLSRC If RPG – spool file take copy by CSPLY ten deletee the lines if ‘HFELICO’ not in the 12 th poistion 8. how would u determine the end of file in CLP. By usinf MONMSG -- CPF0809 9. how many files can be read in a CLP. One. 10. how would u read a file in a CLP. RCVF 11. what is the difference between reade and chain. READE just read the current record, CHAIN – SETLL AND READ , position and read 12. can u save a spool file. yes 13. what are printer over rides. Save, lines pre width, page size, over flow line no, Data 14. what are printer over rides used for. Same as prev 15. how many lines can be printed on a printer file. 10000 16. Key words used for subfile. SFLCTL, SFLDSPCTL, SFLNXTCHG, SFLPAG, SFLSIZ, SFLINZ, SFLRCDNBR, SFLCLR, 17. wht is the use or SFLCTL in a subfile. SFLCTL is used to control the header and detail part. 18. wht r the different types of loading a subfile. SINGLE SHOT = SFLSIZ > SFLPAG Page by Page = SFLSIZ = SFLPAG up and down we have to take care Expanding = ‘’ ‘’ only Down we have to take care 19. what is SFLSIZ and SFLPAG. SLFSIZ = buffer size, SFLPAG = Records to display in screen 20. how can information be passed to another program. DATA AREA, DATAQUEUE, USRSPACE 21. wht is *usrspace. 22. wht is data area. Data area is to store data permanately or temporally. It can be pass between programs also. 23. how to handle file exception and program exception.

7
File exception by INFDS (INFSR) Program exception PSSR 24. what is *PSSR. Program status data structure , to handle program exception errors 25. If u lock a file does all the records in the file get locked. Yes ALCOBJ (LOCKING FILE) 26. how will a record get locked. If we issue Chain command to that record 27. how will a lock be removed from a locked record. DLCOBJ – de allocate object CHAIN with no lock 28. while doing a chain does a record get locked. Yes in Update mode 29. how to read a record without locking it. Chain with 53 position N 30. wht is journal. To take both the images for physical or any other files. Changes made to specific data base file. For that we have to give JRNRCV, 31. wht is comittment control. Commitment control is used to process file operations as a group Commitment control is to save set of transactions done on a file. 32. wht is OVRDBF. - why is it used. To override another member for reading , to read 5 th member of that PF Temporary file creation, overridden to existing file 33. wht r the API's that u have used. QCMDEXC Command – len 80 FLD2 - len 15 ,5 34. how many parameters should b passed to the API - attributes of the parameters. 2 PARAMETERS 35. what is Data queue? Communicate or store data within the job or between jobs 36. SFLNXTCHG If readc wants to read all the records, SFLNXTCHG should be ON. It will on the modified data tag To read the changed subfile record 37. SFLRCDNBR Subfile record no Control fields take F4 to define hidden field of length 4,0 , then select that field to seton SFLRCDNBR 38. RTNCURLOC define two hidden field record and field name of length 10, SETON on the RTNCURLOC field and define the two fields, in program if prompt required then check if field name = field name , then show new select screen 39. SUBSYSTEM Partitioned of the CPU, in which various jobs can be executed 40. JOBQ Overall status of job queues or detailed status of single job, 41. JOBD

8
To determine how jobs can proceed (system process) if more than one jobs present in that jobq 42. OPNQRYF – It will opens the file with set of database records, which satisfies the query selection process. Dynamic query selection Join records from more than one file 3. Data Structures. PSDS A program status data structure (PSDS) can be defined to make program exception/error information available to an RPG IV program. The PSDS must be defined in the main source section; therefore, there is only one PSDS per module. A data structure is defined as a PSDS by an S in position 23 of the data structure statement. A PSDS contains predefined subfields that provide you with information about the program exception/error that occurred. The location of the subfields in the PSDS 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. The keywords must be specified, leftadjusted in positions 26 through 39. Information from the PSDS is also provided in a formatted dump. However, a formatted dump might not contain information for fields in the PSDS if the PSDS is not coded, or the length of the PSDS does not include those fields. For example, if the PSDS is only 275 bytes long, the time and date or program running will appear as N/A. in the dump, since this information starts at byte 276. Link to what IBM says o o o o o o o o o o Program Status Data Structure D SDS D PROC_NAME *PROC name D PGM_STATUS *STATUS code D PRV_STATUS 16 status D LINE_NUM 21 line nu D ROUTINE *ROUTINE name D PARMS *PARMS passed parms D EXCP_TYPE 40 Exception type D EXCP_NUM 43 Exception number

Procedure Status 20S 0 28 Previous Src list Routine Num 42 46

9
o o o o o o o o o o o o o o o o o o o o o o D PGM_LIB library D EXCP_DATA Exception data D EXCP_ID Exception Id D DATE (DATE fmt) D YEAR (YEAR fmt) D LAST_FILE file used D FILE_INFO error info D JOB_NAME D USER D JOB_NUM number D JOB_DATE (UDATE fmt) D RUN_DATE (UDATE) D RUN_TIME (UDATE) D CRT_DATE date D CRT_TIME time D CPL_LEVEL level D SRC_FILE file D SRC_LIB file lib D SRC_MBR file mbr D PROC_PGM is in D PROC_MOD is in D CURR_USER is in 81 91 171 191 199 201 209 244 254 264 270 276 282 288 294 300 304 314 324 334 344 358 90 170 174 198 200S 0 208 243 253 263 269S 0 275S 0 281S 0 287S 0 293 299 303 313 323 333 343 353 367 Date Year Last File Job name User name Job Date Run date Run time Create Create Compiler Source Source Source Pgm Proc Mod Proc Mod Proc Program

o o o o o o o o o o o

Status codes *STATUS Normal Codes Code 00000 00001 indicator on. Condition No exception/error occurred Called program returned with the LR

Exception/Error Codes Code 00100 Condition Value out of range for string operation

10
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o halt less 00114 mapped from a 4 the date range 00120 00121 00122 00123 of program 00202 indicator 00211 00222 00231 too 00112 00113 00101 00102 00103 00104 Negative square root Divide by zero An intermediate result is not large enough contain the result. Float underflow. An intermediate value is small to be contained in the intermediate result field Invalid Date, Time or Timestamp value. Date overflow or underflow. (For example, the result of a Date calculation results in a number greater than HIVAL or than LOVAL.) Date mapping errors, where a Date is character year to a 2 character year and is not 1940-2039. Table or array out of sequence. Array index not valid OCCUR outside of range Reset attempted during initialization step Called program or procedure failed; halt (H1 through H9) not on Error calling program or procedure Pointer or parameter error Called program or procedure returned with

to

when

indicator on 00232 Halt indicator on in this program 00233 Halt indicator on when RETURN operation run 00299 RPG IV formatted dump failed 00333 Error on DSPLY operation 00401 Data area specified on IN/OUT not found 00402 PDA not valid for non-prestart job 00411 Data area type or length does not match 00412 Data area not locked for output 00413 Error on IN/OUT operation 00414 User not authorized to use data area 00415 User not authorized to change data area 00421 Error on UNLOCK operation 00425 Length requested for storage allocation is out of range 00426 Error encountered during storage management operation 00431 Data area previously locked by another program 00432 Data area locked by program in the same process 00450 Character field not entirely enclosed by shift-out and shift-in characters

11
o o o o o o o o o o o o o or in 09999 00501 00502 00802 00803 00804 00805 00907 Failure to retrieve sort sequence. Failure to convert sort sequence. Commitment control not active. Rollback operation failed. Error occurred on COMMIT operation Error occurred on ROLBK operation Decimal data error (digit or sign not The level number of the compiler used to the program does not agree with the level 09998 of the RPG IV run-time subroutines Internal failure in ILE RPG/400 compiler run-time subroutines Program exception in system routine.

valid)

00970 generate number

INFDS o File Information Data Structure A file information data structure (INFDS) can be defined for each file to make file exception/error and file feedback information available to the program. The file information data structure, which must be unique for each file, must be defined in the main source section. The same INFDS is used by all procedures using the files. Link to what IBM says The INFDS contains the following feedback information:      File Feedback (length is 80) Open Feedback (length is 160) Input/Output Feedback (length is 126) Device Specific Feedback (length is variable) Get Attributes Feedback (length is variable)

* Standard RPG feedback area 1-80 DINFDS ds D File *FILE File name D OpenInd 9 9 File open? D EOFInd 10 10 File at eof? D FileStatus *STATUS Status code

* * * *

12
D OpCode Last opcode D Routinr RPG Routine D ListNum Listing line D SpclStat SPECIAL status D RecordFmt Record name D MsgID Error MSGID *OPCODE *ROUTINE 30 38 *RECORD 46 52 37 42S 0 * * * * * *

D* the next 4 fields are available after POST D Screen_P *SIZE Screen size D NLSIn_P *INP NLS Input? D NLSOut_P *OUT NLS Output? D NLSMode_P *MODE NLS Mode?

* * * *

Type name

* Open feedback area 81-240 * NOTE that getting data beyond column 80 is expensive * in terms of program opens... D ODP_TYPE 81 82 * ODP D FILE_NAME 83 93 103 113 123 125 127 129 147 152 154 156 160 162 92 102 112 122 124I 0 126I 0 128I 0 138 148I 0 153I 0 155I 0 159I 0 161 162 * File * * Spool * Spool * Spool * Max * Max * Member * File * Num * Num * Num of * Access *

D LIBRARY Library name D SPOOL_FILE file name D SPOOL_LIB file lib D SPOOL_NUM file num D RCD_LEN record len D KEY_LEN key len D MEMBER name D TYPE type D ROWS PRT/DSP rows D COLUMNS PRT/DSP cols D NUM_RCDS records D ACC_TYPE type D DUP_KEY Duplicate key?

13
D SRC_FILE 163 184 186 188 190 196 197 207 211 213 214 216 218 220 227 163 185I 0 187I 0 189I 0 191I 0 196 206 208I 0 212I 0 213 215 217I 0 219I 0 220 228I 0 * Source * Vol * Max * * Blk * Misc * * Open * Num * Misc * Open * Max * * Misc * Num

file?

D VOL_OFF label offs D BLK_RCDS rcds in bl D OVERFLOW Overflow line D BLK_INCR increment D FLAGS1 flags D REQUESTER Requester name D OPEN_COUNT count D BASED_MBRS based mbrs D FLAGS2 flags D OPEN_ID identifie D RCDFMT_LEN rcd fmt le D CCSID Database CCSID D FLAGS3 flags D NUM_DEVS devs defin

D* I/O feedback area 241-366 D 242 not used D WRITE_CNT 243 count D READ_CNT 247 count D WRTRD_CNT 251 Write/read count D OTHER_CNT 255 I/O count D OPERATION 260 Cuurent operatio D IO_RCD_FMT 261 format name D DEV_CLASS 271 class D IO_PGM_DEV 273 device name D IO_RCD_LEN 283 len of I/O D* POST area 241-nnn D* Display D PGM_DEV_P Program device

* 241246I 0 250I 0 254I 0 258I 0 260 270 272 282 286I 0 * Write * Read * * Other * * Rcd * Device * Pgm * Rcd

241

250

*

14
D DEV_DSC_P 251 260 description D USER_ID_P 261 270 D DEV_CLASS_P 271 271 class D DEV_TYPE_P 272 277 type D REQ_DEV_P 278 278 Requester? D ACQ_STAT_P 279 279 Acquire status D INV_STAT_P 280 280 status D DATA_AVAIL_P 281 281 available D NUM_ROWS_P 282 283I 0 of rows D NUM_COLS_P 284 285I 0 of cols D BLINK_P 286 286 blink? D LINE_STAT_P 287 287 Online/offline? D DSP_LOC_P 288 288 Display location D DSP_TYPE_P 289 289 Display type D KBD_TYPE_P 290 290 Keyboard type D CTL_INFO_P 342 342 Controller info D COLOR_DSP_P 343 343 capable? D GRID_DSP_P 344 344 line dsp? * The following fields apply to ISDN. D ISDN_LEN_P 385 386I 0 number len D ISDN_TYPE_P 387 388 number type D ISDN_PLAN_P 389 390 number plan D ISDN_NUM_P 391 430 number D ISDN_SLEN_P 435 436I 0 sub-address D ISDN_STYPE_P 437 438 sub-address D ISDN_SNUM_P 439 478 sub-address D ISDN_CON_P 480 480 Connection D ISDN_RLEN_P 481 482I 0 address len D ISDN_RNUM_P 483 514 address * Dev * User ID * Device * Device * * * Invite * Data * Number * Number * Allow * * * * * * Color * Grid * Rmt * Rmt * Rmt * Rmt * Rmt * Rmt * Rmt * * Rmt * Rmt

15
D ISDN_ELEN_P Extension len D ISDN_ETYPE_P Extension type D ISDN_ENUM_P Extension num D ISDN_XTYPE_P call type D* ICF D PGM_DEV_P Program device D DEV_DSC_P description D USER_ID_P D DEV_CLASS_P class D DEV_TYPE_P type D REQ_DEV_P Requester? D ACQ_STAT_P Acquire status D INV_STAT_P status D DATA_AVAIL_P available D SES_STAT_P Session status D SYNC_LVL_P level D CONV_TYPE_P Conversation typ D RMT_LOC_P location D LCL_LU_P LU name D LCL_NETID_P net ID D RMT_LU_P LU D RMT_NETID_P net ID D APPC_MODE_P Mode D LU6_STATE_P conv state D LU6_COR_P conv 519 521 522 566 241 251 261 271 272 278 279 280 281 291 292 293 294 302 310 318 326 334 345 346 520 521 561 566 250 260 270 271 272 278 279 280 281 291 292 293 301 309 317 325 333 341 345 353 * * * * X.25 * * Dev * User ID * Device * Device * * * Invite * Data * * Synch * * Remote * Local * Local * Remote * Remote * APPC * LU6 * LU6 * * Rmt * Rmt * Rmt

correlator * The following fields apply to ISDN. D ISDN_LEN 385 386I 0 number len D ISDN_TYPE 387 388 number type D ISDN_PLAN 389 390 number plan

16
D ISDN_NUM number D ISDN_SLEN addr len D ISDN_STYPE addr type D ISDN_SNUM sub-address D ISDN_CON Connection D ISDN_RLEN address len D ISDN_RNUM address D ISDN_ELEN Extension len D ISDN_ETYPE Extension type D ISDN_ENUM Extension num D ISDN_XTYPE call type 391 435 437 439 480 481 483 519 521 522 566 430 436I 0 438 478 480 482I 0 514 520 521 561 566 * Rmt * sub* sub* Rmt * * Rmt * Rmt * * * * X.25

* The following information available only when program started * result of a received program start req. (P_ stands for protected) D TRAN_PGM 567 630 * Trans pgm name D P_LUWIDLN 631 631 * LUWID fld len D P_LUNAMELN 632 632 * LUNAME len D P_LUNAME 633 649 * LU-NAME D P_LUWIDIN 650 655 * LUWID instance D P_LUWIDSEQ 656 657I 0 * LUWID seq num * Below info is available only when a protected conversation * is started on a remote system. (U_ stands for unprotected) D U_LUWIDLN 658 658 * LUWID fld len D U_LUNAMELN 659 659 * LUNAME len D U_LUNAME 660 676 * LU-NAME D U_LUWIDIN 677 682 * LUWID instance D U_LUWIDSEQ 683 684I 0 * LUWID seq num D* Device independent area 367-nnn D* NOTE that this area is shared with the POST feedback area above! D* Printer

17
D CUR_LINE Current line num D CUR_PAGE Current page cnt D PRT_MAJOR ret code D PRT_MINOR ret code D* Disk D FDBK_SIZE of DB fdbk D JOIN_BITS bits D LOCK_RCDS locked rcds D POS_BITS pos bits D DLT_BITS deleted bits D NUM_KEYS keys (bin) D KEY_LEN length D MBR_NUM number D DB_RRN Relative-rcd-num D KEY value (max D* 2000) D* ICF D ICF_AID 367 369 401 403 368I 0 372I 0 402 404 * * * Major * Minor

367 371 377 385 384 387 393 395 397 401

370I 0 374I 0 378I 0 385 384 388I 0 394I 0 396I 0 400I 0 2400

* Size * JFILE * Nbr * File * Rcd * Num * Key * Member * * Key * size

byte

369 372 401 403 405 413 415 416 430

369 375I 0 402 404 412 413 415 425 437

* AID * Actual * Major * Minor * SNA * Safe * * Remote * Mode

D ICF_LEN data len D ICF_MAJOR ret code D ICF_MINOR ret code D SNA_SENSE sense rc D SAFE_IND indicator D RQSWRT Request write D RMT_FMT rcd fmt D ICF_MODE name D* Display D DSP_FLAG1 Display flags

367

368

*

18
D DSP_AID 369 370 372 376 378 380 382 369 371 375I 0 377I 0 379I 0 381I 0 383 * AID * Cursor * Actual * * * * Active * 401 403 402 404 * Major * Minor

byte

D CURSOR location D DATA_LEN data len D SF_RRN Subfile rrn D MIN_RRN Subfile min rrn D NUM_RCDS Subfile num rcds D ACT_CURS window D* cursor location D DSP_MAJOR ret code D DSP_MINOR ret code 4. Debug a program in BATCH.

1. Hold the JobQ (Eg: QBATCH) 2. Submit the job. 3. Hold the job – Take option 3 against the job in “Work with submitted jobs”. 4. Release the JobQ 5. Take option 5 against the job to be debugged and make a note of the “Job Name”, “User”, and “Job Number”. 6. Execute the command STRSRVJOB – Start Service Job. Input the Job Name, User, Job Number. 7. STRDBG – Start Debug. 8. Release the job that is on hold – Take option 6 against the job on hold to release. 9. Once the job is released, a screen is displayed which tells u to add the break points. Take F10 and execute the command ADDBKP. 10.Then it is the normal way of debug using STRDBG. 5. SDLC DEFINITION: Definition System Development Life Cycle (SDLC) is the overall process of developing information systems through a multistep process from investigation of initial requirements through analysis, design, implementation and maintenance. There are many different models and methodologies, but each generally consists of a series of defined steps or stages. MAY 14, 2002 (COMPUTERWORLD) - Once upon a time, software development consisted of a programmer writing code to solve a problem or automate a procedure. Nowadays, systems are so big and complex that teams of architects, analysts, programmers, testers and users must work together to create the millions of lines of custom-written code that drive our enterprises.

19
To manage this, a number of system development life cycle (SDLC) models have been created: waterfall, fountain, spiral, build and fix, rapid prototyping, incremental, and synchronize and stabilize. The oldest of these, and the best known, is the waterfall: a sequence of stages in which the output of each stage becomes the input for the next. These stages can be characterized and divided up in different ways, including the following:

• • • • • • •

Project planning, feasibility study: Establishes a high-level view of the intended project and determines its goals. Systems analysis, requirements definition: Refines project goals into defined functions and operation of the intended application. Analyzes end-user information needs. Systems design: Describes desired features and operations in detail, including screen layouts, business rules, process diagrams, pseudocode and other documentation. Implementation: The real code is written here. Integration and testing: Brings all the pieces together into a special testing environment, then checks for errors, bugs and interoperability. Acceptance, installation, deployment: The final stage of initial development, where the software is put into production and runs actual business.

Maintenance: What happens during the rest of the software's life: changes, correction, additions, moves to a different computing platform and more. This, the least glamorous and perhaps most important step of all, goes on seemingly forever. But It Doesn't Work! The waterfall model is well understood, but it's not as useful as it once was. In a 1991 Information Center Quarterly article, Larry Runge says that SDLC "works very well when we are automating the activities of clerks and accountants. It doesn't work nearly as well, if at all, when building systems for knowledge workers -- people at help desks, experts trying to solve problems, or executives trying to lead their company into the Fortune 100." Another problem is that the waterfall model assumes that the only role for users is in specifying requirements, and that all requirements can be specified in advance. Unfortunately, requirements grow and change throughout the process and beyond, calling for considerable feedback and iterative consultation. Thus many other SDLC models have been developed. The fountain model recognizes that although some activities can't start before others -- such as you need a design before you can start coding -- there's a considerable overlap of activities throughout the development cycle. The spiral model emphasizes the need to go back and reiterate earlier stages a number of times as the project progresses. It's actually a series of short waterfall cycles, each producing an early prototype representing a part of the entire project. This approach helps demonstrate a proof of concept early in the cycle, and it more accurately reflects the disorderly, even chaotic evolution of technology.

20

Build and fix is the crudest of the methods. Write some code, then keep modifying it until the customer is happy. Without planning, this is very open-ended and can by risky. In the rapid prototyping (sometimes called rapid application development) model, initial emphasis is on creating a prototype that looks and acts like the desired product in order to test its usefulness. The prototype is an essential part of the requirements determination phase, and may be created using tools different from those used for the final product. Once the prototype is approved, it is discarded and the "real" software is written. The incremental model divides the product into builds, where sections of the project are created and tested separately. This approach will likely find errors in user requirements quickly, since user feedback is solicited for each stage and because code is tested sooner after it's written. Big Time, Real Time The synchronize and stabilize method combines the advantages of the spiral model with technology for overseeing and managing source code. This method allows many teams to work efficiently in parallel. This approach was defined by David Yoffie of Harvard University and Michael Cusumano of MIT. They studied how Microsoft Corp. developed Internet Explorer and Netscape Communications Corp. developed Communicator, finding common threads in the ways the two companies worked. For example, both companies did a nightly compilation (called a build) of the entire project, bringing together all the current components. They established release dates and expended considerable effort to stabilize the code before it was released. The companies did an alpha release for internal testing; one or more beta releases (usually feature-complete) for wider testing outside the company, and finally a release candidate leading to a gold master, which was released to manufacturing. At some point before each release, specifications would be frozen and the remaining time spent on fixing bugs. Both Microsoft and Netscape managed millions of lines of code as specifications changed and evolved over time. Design reviews and strategy sessions were frequent, and everything was documented. Both companies built contingency time into their schedules, and when release deadlines got close, both chose to scale back product features rather than let milestone dates slip. 6.Joining Files Using OPNQRYF Detailed Description : Some customers have asked us for an Example of LANSA reading a join file created by OPNQRYF The example below uses OPNQRYF to join the following files: Filename: FILE1 Fields Type Length FIELD1 Alpha 5 (File key)

21
FIELD2 Alpha 5 Filename: FILE2 Fields Type Length FIELD1 Alpha 5 (File key) FIELD3 Alpha 5 Filename: FILE3 Fields Type Length FIELD1 Alpha 5 (File key) FIELD4 Alpha 5 An extra file is needed for OPNQRYF to use as a "result" record format for the join... Filename: JOINFILE Fields Type Length FIELD1 Alpha 5 (File key) FIELD2 Alpha 5 FIELD3 Alpha 5 FIELD4 Alpha 5 Important notes when defining JOINFILE... • • • When defining this file to LANSA, use the data base attributes screen to define the file as SHARE..YES. Also put "SHARE(*YES)" at the bottom of the screen in the CRTPF parameters section. Make sure JOINFILE has been defined as having at least one key. The key does not have to match the keys of the result file produced by OPNQRYF. All of the above files were created using LANSA so they all will have the field @@UPID automatically added to the record formats. Once the above files are compiled, a function can be written to execute the OPNQRYF and read the file. OPEN POINT DEF_LIST ********** EXEC_OS400 *ALL *ONDEMAND FILE(JOINFILE) TOFILE(FILE1) #LIST (#FIELD1 #FIELD2 #FIELD3 #FIELD4) Execute the OPNQRYF ('OPNQRYF FILE(FILE1 FILE2 FILE3) FORMAT (JOINFILE) JFLD((FILE1/FIELD1 FILE2/FIELD1 )) ((FILE1/FIELD1FILE3/FIELD1)) MAPFLD((FI ELD1’FILE1/FIELD1')(@@UPID'FILE1/@@UPID')) ********** Open JOINFILE immediately so LANSA will ********** not do a "SETLL" OPEN FILE(JOINFILE) USE_OPTION(*IMMEDIATE) SELECT FIELDS(#LIST) FROM_FILE(JOINFILE) ADD_ENTRY #LIST ENDSELECT CLOSE JOINFILE ********** Close file created by OPNQRYF EXEC_OS400 COMMAND('CLOF FILE1') DISPLAY BROWSELIST(#LIST)

1 2 3 4 5

6 7 8 9 10 11 12 13 14

Important notes about the above function...

22
• • The JOINFILE must be opened "*ONDEMAND" so that it is not opened before the OPNQRYF is executed. See statement 1. OPNQRYF will create a file that is exactly the same as the file specified in the FORMAT() parameter but the actual file name will be the name of the first file specified in the FILE() parameter. For this reason, the function SELECTs from JOINFILE but JOINFILE is POINTed to FILE1. See statement 2. Just before the JOINFILE is read, open it *IMMEDIATEly. When this is done, LANSA knows the file has just been opened so it does not attempt to use SETLL (RPG operation) to position the file to the beginning before the first read. See statement 7. (Using RPG's SETLL on a file created by OPNQRYF is invalid and it will cause the function to abort). After reading the JOINFILE, CLOSE it and then use the CL command "CLOF" to close the file (FILE1) created by OPNQRYF. See statement 13.

There is another solution, by following the instructions detailed below LANSA can be tricked into reading the join logical file without using OPNQRYF: 1. Create a physical file with the same name and record format as the join logical. This will have to be created in a different library from the join logical. 2. Load this file as an 'OTHER' file into LANSA. 3. Compile the file. 4. Rename the physical file created outside of LANSA or delete the file. It is probably best to rename it as it may be necessary to make changes and reload it at a later stage. 5. Do a CHGLF on the join file LVLVHK(*NO). 6. Make sure that the join logical file is in the library list. 7. It is now possible to do reads of the join logical file via the LANSA I/O module.

7. OPNQRYF - Short explanation with some samples. CL-PROGRAM FUNCTION.....: RETRIEVE/SELECT DATA WITH THE CL-COMMAND OPNQRYF. ILLUSTRATED IN SAMPLES 1 - 3. TASK.........: RETRIEVE USERINFO ON FIELDS FROM THE USRPRF-FILE. USE THE CL-COMMAND DSPUSRPRF *ALL OUTPUT(*OUTFILE) FILE(LIB/QRYSLTPF). LIB IS YOUR OWN TEST-LIBRARY. THE PROGRAM ONLY USES 2 FIELDS TO AVOID CONFUSION. IN THIS PROGRAM THE TEST-LIBRARY IS JPHLIB. INPUT........: DB-FILE: FIELDS: QRYSLTPF UPUPRF UPUID 10 A 10 P0

DISCLAIMER...: THE DATA RETRIEVED AND THE COMBINATION OF FIELDS IS COMPLETELY NONSENSE AND INTENDED ONLY TO ILLU-

23
STRATE THE USE OF THIS COMMAND. CREATE BETTER EXAMPLES ON YOUR OWN !! CREATE A FILE IN YOUR TESTLIBRARY CALLED BRUG. THIS IS THE FILE THAT RECIEVES OUTPUT-DATA FROM THE OPNQRYF. OUTPUT.......: DB-FILE: FIELDS: BRUG UPUPRF UPUID 10 A 10 P0

THE SELECTED

OPENID IN THE OPNQRYF-STATEMENT IS YOUR REFERENCE TO INTERNAL OPNQRYF-OUTPUT. USE THIS NAME AS FROM-FILE IN THE FINAL CPYFRMQRYF WHERE YOU RETRIEVE THE DATA TO A PHYSICAL FILE.

TIP..........: BE ABSOLUTELY SURE TO USE THE RIGHT NUMBER OF QUOTES ( ' ) WHEN YOU DEFINE THE SELECT-STATEMENT. ALL CHAR-VARIABLES IN THE OPNQRYF SELECT-LINE MUST BE EMBEDDED IN TRIPLE-QUOTES AND *CAT: OR ''' *CAT &CHARVAR *CAT ''' "' *CAT &CHARVAR *CAT '" WRITTEN BY...: JENS PETER HOEJGAARD 15.04.2002 HOVEDGADEN 60 DK-8832 SKALS DENMARK MAIL: JEPHOJ@MAIL.DK CHANGED BY...: JENS PETER HOEJGAARD 16.05.2002 PGM DCL DCL DCL DCL DCL DCLF VAR(&USER) TYPE(*CHAR) LEN(10) VAR(&NR) TYPE(*DEC) LEN(10 0) VAR(&EX) TYPE(*DEC) LEN(1 0) VAR(&NRALF) TYPE(*CHAR) LEN(10) VAR(&X) TYPE(*CHAR) LEN(1) + VALUE(' ') FILE(QRYSLTDF) RCDFMT(*ALL) */ */

/* THE VAR X HELPS TO LEAVE THE LIBRARY-LIST UNCHANGED /* WHEN THE PROGRAM HAS FINISHED PROCESSING. ADDLIBLE MONMSG

LIB(JPHLIB) MSGID(CPF2103) EXEC(CHGVAR VAR(&X) VALUE('X')) */

/* PROMPT FOR NAME OG ID AND TYPE OF EXAMPLE CHOISE: SNDRCVF RCDFMT(F0)

/* QRYSLT ONLY OPERATES WITH ALFA-VARIABLES. THE NUME-

*/

24
/* RIC VAR. &NR IS CONVERTED TO CHAR. &NRALF /* USED IN SAMPLE 3. CHGVAR VAR(&NRALF) VALUE(&NR) */ */ */

/* F3 WAS PRESSED ON THE SCREEN IF IF IF IF

COND(&IN03 = '1') THEN(GOTO CMDLBL(END)) COND(&EX = 1) THEN(GOTO CMDLBL(ONE)) COND(&EX = 2) THEN(GOTO CMDLBL(TWO)) COND(&EX = 3) THEN(GOTO CMDLBL(THREE))

/*****************************************************************/ /* SAMPLE ONE: CHAR CONSTANT AND NUM CONSTANT */ /*****************************************************************/ ONE: OPNQRYF FILE((JPHLIB/QRYSLTPF)) + QRYSLT(' + (UPUPRF *EQ ''JPH'') + *AND + (UPUID *EQ 338) + ') + OPNID(BRUG) CMDLBL(OUT)

GOTO

/*****************************************************************/ /* SAMPLE TWO: CHAR VARIABLE AND NUM CONSTANT */ /*****************************************************************/ TWO: OPNQRYF FILE((JPHLIB/QRYSLTPF)) + QRYSLT(' + (UPUPRF *EQ ''' *CAT &USER *CAT ''') + *AND + (UPUID *EQ 338) + ') + OPNID(BRUG) CMDLBL(OUT)

GOTO

/*****************************************************************/ /* SAMPLE THREE: CHAR VARIABLE OG NUM VARIABLE. */ /* DIGITS IS A OPNQRYF KEYWORD THAT CONVERTS */ /* A FIELD FROM NUMERIC TO ALFA (CHAR.) */ /*****************************************************************/ THREE: OPNQRYF FILE((JPHLIB/QRYSLTPF)) + QRYSLT(' + (UPUPRF *EQ ''' *CAT &USER *CAT ''') + *AND + (%DIGITS(UPUID) *EQ ''' *CAT &NRALF *CAT ''') + ') + OPNID(BRUG)

25

GOTO

CMDLBL(OUT)

/*****************************************************************/ /* MAKE A COPY OF THE OPNQRY OUTPUTFILE TO THE PF BRUG */ /*****************************************************************/ OUT: CPYFRMQRYF FROMOPNID(BRUG) TOFILE(JPHLIB/BRUG) + MBROPT(*ADD) CLOF DLTOVR GOTO OPNID(BRUG) FILE(*ALL) CMDLBL(CHOISE) */

/* LIBRARY-LIST IS RESTORED END: IF RCLRSC RETURN ENDPGM

COND(&X = ' ') THEN(RMVLIBLE LIB(JPHLIB))

8. OPNQRYF and Quotation Marks Hey, Ted: I have to create a record selection expression for a character field that can have values like 4" in it. When an expression like ATSIN *EQ "4"" occurs, the Open Query File (OPNQRYF) command gives an error. Is there a way around it? -- Nonna You'll have to double something in your code. In your example, you surround the literal 4" with double quote marks ( " ). You need to change the one double quote mark following the number 4 to two double quote marks. Your query selection string will look like this: ATSIN *EQ "4""" The other way to do this is to use two single quote marks ( ' ) to delimit the literal, like this: ATSIN *EQ ''4"'' That's single quote single quote the numeral four a double quote single quote single quote.

26
Here's some CL code that illustrates this concept. &DESC is the field holding the user input. &DWORK holds the user input with doubled quote marks. DCL DCL DCL DCL DCL DCL &DESC &DWORK &QRYSLT &DBLQUOTE &INX &OUTX *CHAR *CHAR *CHAR *CHAR *DEC *DEC LEN( 25) LEN( 50) LEN(256) LEN( 1) VALUE('"') LEN(3 0) LEN(3 0)

/* Get value of &DESC using some input method here */ /* Begin routine to change a double quote to two */ /* double quotes so OPNQRYF selects records properly */ CHGVAR CHGVAR NextChar: CHGVAR IF &INX &OUTX 1 1 %SST(&DESC &INX 1)

%SST(&DWORK &OUTX 1)

(%SST(&DESC &INX 1) *EQ &DBLQUOTE) DO CHGVAR &OUTX (&OUTX + 1) CHGVAR %SST(&DWORK &OUTX 1) (&DBLQUOTE) ENDDO CHGVAR CHGVAR IF &INX &OUTX (&INX + 1) (&OUTX + 1)

(&INX *LE 25) THEN(GOTO NextChar)

/* End routine to double quotation marks */ CHGVAR &QRYSLT VALUE('PMDESC *CT' *bcat + &DblQuote *cat + &DWork *tcat + &DblQuote)

OPNQRYF -- Ted OAGRPG1 :

FILE((PARTS)) QRYSLT(&QRYSLT)

************************************************************** H/TITLE OAG TEST PROGRAM. * FOAGPF1 O E DISK * C Z-ADD1 COUNT 50 C COUNT DOWLE3 C MOVE COUNT SLNO C WRITEREC1 C ADD 1 COUNT

27
C C ENDDO SETON LR

*

9. Page by Page Build : *************************************************************** H/TITLE OAG TEST PROGRAM * F*OAGPF1 IF E DISK F* OAGPF1 KRENAMEREC1 * C* READ REC1 90 C* MOVELSLNO SN 5 * C* RETRN ************************************************************ FRSEDSP CF E WORKSTN F #RRN KSFILE SFLREC FOAGLF1 IF E K DISK F OAGPF1 KRENAMEREC1 * C Z-ADD*ZEROS #RRN 40 C Z-ADD*ZEROS COUNT 40 C MOVEL*BLANKS WRK 5 * C EXSR CLEAR C EXSR BUILD * C *IN03 DOWEQ*OFF C EXFMTSFLCTL C 03 LEAVE C C C C C C C C C C C C C C C C C C C * *IN09 90 IFEQ *ON SETOF ITER Z-ADD*ZEROS EXSR CLEAR EXSR BUILD ITER ENDIF IFEQ *ON SETOF ADD #RRN ADD #RRN IFEQ *ON SETGTREC1 ENDIF DO COUNT READPREC1 IFEQ *ON SETLLREC1 91 PAGE DOWN 09 #RRN

* *IN10 90 N90 6 5 *IN90 *HIVAL

10 COUNT COUNT

PAGE UP

* *IN91 *LOVAL

28
C C C C C C C C C C C C C C C C C C C C C C * C * POS POS *LOVAL LEAVE ENDIF ENDDO Z-ADD*ZERO EXSR CLEAR EXSR BUILD ITER ENDIF IFNE WRK ANDEQ*BLANKS EXSR CLEAR Z-ADD*ZEROS SETLLREC1 EXSR BUILD ELSE MOVELPOS EXSR CLEAR Z-ADD*ZEROS SETLLREC1 EXSR BUILD ENDIF ENDDO

#RRN

#RRN

WRK #RRN

POS *

SETON LR *************************************************************** C CLEAR BEGSR C SETON 28 WRITESFLCTL C 28 C ENDSR *************************************************************** C BUILD BEGSR C DO 5 C READ REC1 90 C 90 LEAVE C ADD 1 #RRN MOVELSLNO #SLNO C MOVELNAME #NAME C MOVELDESC #DESC C WRITESFLREC C ENDDO * C #RRN IFGT *ZERO C SETON 26 C ELSE C SETOF 26 C ENDIF C SETON 27 C ENDSR **************************************************************** 10. Procedure Basics

C SETOF

C

29

A very typical place to start with new procedures is to prototype a system API, like the translate API. Original inline code looked like this: C C C C C CALL 'QDCXLATE' PARM FLDLEN PARM TEXT PARM TBLNAM PARM LIBNAM

This code frag was in 3 places in the program: a perfect candidate for a subroutine. There were 3 different fields being translated to upper case: TEXT, DESC and TITLE. This meant inline code that looked like this: C C C C C C with a subr like: C C C C C C C UCASE BEGSR CALL 'QDCXLATE' PARM FLDLEN PARM XFIELD PARM TBLNAM PARM LIBNAM ENDSR MOVELTEXT EXSR UCASE MOVELDESC EXSR UCASE MOVELTITLE EXSR UCASE XFIELD XFIELD XFIELD

This subr can easily be turned into a procedure: C CallP UCASE(Text)

* Translate lower to upper case P UCASE B D UCASE PI D WorkString 50 C C C C C C P UCASE CALL PARM PARM PARM PARM Return E 'QDCXLATE' FLDLEN WorkString TBLNAM LIBNAM

This procedure has a problem: it isn't stand-alone because of the three global variables FLDLEN, TBLNAM and LIBNAM. In order to use this procedure in another program, I'd need to define and populate these exact field names in the new program. Sounds like a perfect use for some more parameters:

30

C

CallP

UCASE(Text:'QSYSTRNTBL':'QSYS')

* Translate lower to upper case P UCASE B D UCASE PI D WorkString 50 D XlateTableNam 10 D XlateTableLib 10 D WorkStringLen C C C C C C C P UCASE S Eval CALL PARM PARM PARM PARM Return E 5p 0

Value Value

WorkStringLen = %len(WorkString) 'QDCXLATE' WorkStringLen WorkString XlateTableNam XlateTableLib

This is a bit better because if I decide to change the length of the input string, I don't need to change the guts of the code - it determines the length using the %len BIF. But still, it seems kind of goofy to specify the translate table name for every CALLP to a procedure named UCASE. This procedure really does the function TRANSLATE. If I rename this one TRANSLATE, I could make a new procedure called UCASE that will only perform the uppercase function: C CallP UCASE(Text)

* Translate lower to upper case P UCASE B D UCASE PI D WorkString 50 C C P UCASE E CallP Return Translate(WorkString:'QSYSTRNTBL':'QSYS')

* Translate string according to supplied table P Translate B D Translate PI D WorkString 50 D XlateTableNam 10 Value D XlateTableLib 10 Value D WorkStringLen C C C C C S Eval CALL PARM PARM PARM 5p 0 WorkStringLen = %len(WorkString) 'QDCXLATE' WorkStringLen WorkString XlateTableNam

31
C C P Translate PARM Return E XlateTableLib

Difference between Procedure and Subroutine. A procedure is encapsulated, where a subroutine is not. That is, a procedure can see variables that it defines, but not variables that the main program defines. This makes it a lot easier to determine what a procedure is actually doing and where it's getting it's return value(s). This makes a procedure "stand alone", and can be used in other programs with little modification (modification required for any File I/O may be required) It can be extremely difficult to copy a subroutine to another program, as you have to determine all the variables the subroutine uses, and what these are supposed to be set for, etc...

11. AS400 Questions: 1. How can u send Parameters through LDA to another program and how do you receive? CHGDTAARA-CL RCVDTARA-CL IN and OUT in RPG 2. In P.F you are having no records and you write SFL Program. Then how can you know that there are no records in P.F? Which make you to show there are no records? If the first Read returns End of file then there is no records in the PF 3. How can u send data’s of P.F to data Queue and how to receive the data Queue and how to copy it to your file? Read PF QSNDTAQ 4. Can we journel logical file and access path? No 5. Can we use commitment control for non-join L.F? No 6. What are the activation groups’ commands that are used? RCLACTGRP

32
7. What is special about QTEMP library? Specific to JOB 8. What is the purpose of QRPGOBJ library? Library for Storing RPG Objects 9. Where is the SYS library list defined? QSYS 10.How will you DCL a trigger in RPG? Trigger is a Program that will execute automatically on File Operation 11.How to call trigger? Trigger is a Program that will execute automatically on File Operation 12.How to lock a particular record and how to open the lock in RPG? READ, CHAIN –To lock the record UPDATE and DELETE for Unlock

13.Difference between RPGLE and OPM? OPM Program Compilation results in a runnable program Compile, run Run units simulated for each language Dynamic program call Single-language focus Language-specific error handling OPM debuggers ILE Program Service program Compilation results in a nonrunnable module object Compile, bind, run Activation groups Dynamic program call Static procedure call Mixed-language focus Common error handling Languagespecific error handling Source-level debugger

14.What are ARRAY mandatory key words? DIM, if it is a compile time array then - CTDTA and PERRCD If it is a pre run time array then we need to declare a file as Table “T” 15.How will you override particular file during runtime? OVRDBF 16.What is the status where copy is pending? JOBQ 17.What are the uses of FRCDTA?

33
Use this record-level keyword to display a record format immediately, without waiting for the next input or input/output operation. When the buffer is partially full, the FRCDTA keyword can be used to clear the buffer. 18.What are runtime API in RPG? QCMDEXC, QRCVDTAQ, QSNDDTAQ, QCLRDTAQ. 19.How to define multidimensional array? Declare a Multi occurrence data structure and declare the array within the data structure. 20.How do you retrieve the job name from batch job currently running in the system and the library of that job from the group data area? 21.How will you change the printer files to different language with out changing the code or without using additional parameters? 22.How to make display the 5th member as default in RPG program? OVRDBF 23.Why cannot we update using Join-Logical file? 24.How to update a file without using file opcodes? RPG Life Cycle 25.How to display a screen without using EXFMT? WRITE READ 26.What is API’s in Data Queue? QSNDDTAQ QRCVDTAQ QCLRDTAQ 12. Design Report RLU is used to design a report image, print prototype reports, create printer files, and generate DDS from which the report will be created. A prototype report is a printed copy of the report image that looks like the report that an application program will generate. The Design Report display is the main screen from which you edit the report. From this display you can use function keys to go to other displays where you can add information at the file, record and field levels. You can also go to the Change Session Defaults display where you can control the characteristics of your edit session. There are two ways to print your prototype report. RLU you can specify option 6 to print from the STRRLU within the session you can specify that you want to Exit RLU display. On the Exit display choose Prototype report prompt and the report will be printed. There are session: a few things you should keep in mind When you start display. From print from the Y=Yes for the your RLU

during

34

o Once the DDS source has been coded for your report you can edit the image using the field line, the mark function keys that allow you to move and copy fields and data, and the other function keys that bring up displays that will help you edit your report. o You must define a record format prior to defining fields. can use the DR command to do this. You

o Ensure that all fields for a record are defined. You can use the DF (define field) command to do this or you can define fields on the Define Field Information display. To get to the Define Field Information display press F11 when your cursor is not on an existing field. o To show overlapping fields or fields which are conditioned off, use the VF command. This will display the field line or multiple field lines for the line. o You command. can merge records by using the CL (change line type)

o There are two sets of function keys in RLU. There is a base set and an alternate set. You can toggle between the two sets using F22. The base function keys are RLU specific. You use them to edit the report you are working on, and to access the other RLU displays. The alternate function keys are more general than the base set. They are based on the function keys for the Edit display in SEU. When the base function keys are active, you see BASE to the left of the format line. This is the third line from the top of the display that marks the columns across the display. When the alternate function keys are active, you see ALT. o You should not move fields to filler lines. you have defined for the field will be lost. If you do, everything

o There is a command line at the top of the Design Report display that you can use to enter commands specific to your RLU session. You can enter system commands by pressing F21 in the alternate set of function keys. A system command line will appear on the display. Columns This field displays which columns are currently visible on the display. The first number in this field represents the first column of the report line that is shown. The second number represents the last column that is shown. Library/Source file The name of the library and the source file containing the report you are editing. Command line RLU commands provide a shortcut to the functions on the Find/Change Options, Find Options, Exit, and Change Session Defaults displays

35
without leaving the work screen. RLU commands are free format commands. The command parameters are either required and positional, or optional, and they can be entered in any order. To run an RLU command, type it on the positional function key: for example, F19=Left, F20=Right. command line and press a Enter, Roll Up or Down,

Some commands have abbreviations: for example, you can enter F or FIND to run the FIND command. To retrieve the last command you entered, type F9=Retrieve. If the cursor is in the data area, you can use F10=Cursor to move the cursor back and forth between the data area and the command line. RLU remembers up to 50 commands. To see help for an RLU command, type the command on the command line and press the Help key. Note: You cannot enter system commands on the command line, but you can enter a system command on the work screen by pressing F21=System command. A window appears where you can enter a system command. You can enter the following RLU commands on any command line on the work screen (Edit, Browse or Split displays): o FIND or F o o o o o o o o CHANGE or C SAVE CANCEL or CAN FILE TOP BOTTOM SET or S HIDE or H Edit

Note: FILE, SAVE, and CHANGE commands can only be used in an session or in the top session of a Split Edit/Browse display. The SET command has these options: o o o o o o MATCH CAPS TABS ROLL EXPERT SHIFT

Note: The SHIFT and TABS options can only be used in an Edit or in the top session of a Split dit/Browse display. Report The name of the report you are editing. Active keys BASE indicates that the base function keys are active. that the alternate keys are active. Format line ALT

session

indicates

36

The ruled line at the top of the display. Line control area The area on the display consisting of line numbers and record format names. You can enter line commands in this area. The following line commands are available in RLU, in addition to SEU line commands: o o o o o o o o o Define Record Format (DR) Change Line Type (CL) Create Sample Data (SD) View Field Line (VF) New Page (NP) Define Constants (DC) Define Fields (DF) Center Fields (CF) Space Fields Evenly (SP) editing. This most

Work area The work area for the report you are designing or area consists of the following three types of lines:

Report line A report line is any line of the report that is part of a record format. Report lines are involved in DDS source generation. The first report line in a record format is indicated by an R in the line number area. Subsequent report lines, which are called continuation lines, are indicated with a + in the line number area. Sample line A sample line is a line used to make the report you are editing look more like the final report. Sample lines contain sample data that is associated with the preceding record format. The first sample line in a group of sample lines is indicated by an S in the line number area. Subsequent sample lines, which are called continuation lines, are indicated by a + sign in the line number area. These lines are not involved in DDS source generation. Filler line Filler lines are lines that separate one record format from another. They are indicated by a . (period) in the line number area. Filler lines are involved in DDS source generation. Field Line A field line is a temporary record that may be displayed above the report line and is denoted by FLDn in the sequence number area, where n=1, 2, or 3. The field line indicates field boundaries within the record, allows editing of fields in the record, and accepts certain commands to facilitate field generation. F1=Help Press F1 for additional help about using the display. F3=Exit

37
Press F3 to go to the Exit RLU display. F4=Fields Press F4 to work with a list of the fields within a DDS record F5=Refresh Press F5 to restore all entries to what they were initially. F6=Condition display Press F6 to go to the Condition Design Report display to indicators on or off to condition the fields and keywords and they are displayed on the work screen. F9=Retrieve Press F9 to retrieve the last command entered. F10=Database fields Press F10 to go to the Work with Database Fields display where you can build a list of database fields to display at the bottom of the work display for inclusion in the report. F11=Define field Press F11 when the cursor is not on an existing field and the Define Field Information display appears where you can create a new field. F12=Cancel Press F12 to cancel the Split Edit/Browse or Split Edit/Prompt session. You will return to a single Design Report session. F13=Mark/Unmark data Press F13 to mark a character, field, or block of text to be copied or moved. If something has been marked, and you move the cursor to another area and press F13 again, the new area will be highlighted along with the first area you highlighted. Now you can use F14 to copy the data to the new marked area, or F15 to move the data to the new marked area. If you press F13 again with your cursor on the marked area the marked text will be unmarked. You can change the way a move or copy is performed by going to the Change Session Defaults display. F14=Copy marked data Press F14 to copy a marked area to another area. Your cursor be in the top left corner of the area you are copying to press F14. should when you set how format.

F15=Move marked data Press F15 to move a marked area to another area. Place your cursor in the top left corner of the area you are moving the marked data to and press F15. F16=Delete field Press F16 on a field line, report line, or sample line to delete the field's text and the associated sample data, as well as all associated field level information from the Design Report display. F17=File keywords

38
Press F17 to go to the Work with File Keywords display, where you can change the file level definition. If you used the Input Keywords display the last time you worked with keywords then the Input File Keywords display will appear when you press F17. F18=Record keywords Press F18 on a report line or sample line to go to the Work with Record Keywords display. If you used the Input Keywords display the last time you worked with keywords then the Input Record Keywords display will appear when you press F18. F19=Left Press F19 to move the record area to the left on the display. F20=Right Press F20 to move the record area to the right on the display. F21=System command Press F21 to display commands. an entry window where you can input system

F22=Alternative keys Press F22 to display the alternative set of function keys. F23=Field keywords Press F23 with the cursor on an existing field and the Work with Field Keywords display appears where you can change field definitions. If you used the Input Keywords display the last time you worked with keywords then the Input Field Keywords display will appear when you press F23. F24=More keys Press F24 to view the other function keys available.

13. System Development Life Cycle Model This is also known as Classic Life Cycle Model (or) Linear Sequential Model (or) Waterfall Method. This has the following activities. 1. System/Information Engineering and Modeling 2. Software Requirements Analysis 3. Systems Analysis and Design 4. Code Generation 5. Testing 6. Maintenance System/Information Engineering and Modeling As software is always of a large system (or business), work begins by establishing requirements for all system elements and then allocating some subset of these requirements to software. This system view is essential when software must interface with other elements such as hardware, people and other resources. System is the basic and very critical requirement for the existence of software in any entity. So if

39
the system is not in place, the system should be engineered and put in place. In some cases to extract the maximum output, system should be re-engineered and spiced up. Once the ideal system is engineered or tuned up, the development team studies the software requirement for the system. Software Requirements Analysis This is also known as feasibility study. In this phase, the development team visits the customer and studies their system. They investigate the need for possible software automation in the given system. By the end of the feasibility study, the team furnishes a document that holds the different specific recommendations for the candidate system. It also includes the personnel assignments, costs, project schedule, and target dates. The requirements gathering process is intensified and focussed specially on software. To understand the nature of the program(s) to be built, the system engineer ("analyst") must understand the information domain for the software, as well as required function, behavior, performance and interfacing. The essential purpose of this phase is to find the need and to define the problem that needs to be solved . System Analysis and Design In this phase, the software's overall structure and its nuances are defined. In terms of the client/server technology, the number of tiers needed for the package architecture, the database design, the data structure design etc are all defined in this phase. Analysis and Design are very crucial in the whole development cycle. Any glitch in the design phase could be very expensive to solve in the later stage of the software development. Much care is taken during this phase. The logical system of the product is developed in this phase. Outsource your Software and Web Development Projects to Stylus We've been in the business of Internet applications for the past four years and our services include Internet solutions, custom software development, web design and web application development, web enabling legacy systems, technical support and maintenance of web applications. Our Value Proposition - our development methodology, our project management skills and adherence to high- quality and low risk solutions. Contact us here if you are interested in outsourcing projects to Stylus. Code Generation The design must be translated into a machine-readable form. The code generation step performs this task. If design is performed in a detailed manner, code generation can be accomplished with out much complication. Programming tools like Compilers, Interpreters, Debuggers are used to generate the code. Different high level programming languages like C, C++, Pascal, Java are used for coding. With respect to the type of application, the right programming language is chosen. Testing Once the code is generated, the program testing begins. Different testing methodologies are available to unravel the bugs that were committed during the previous phases. Different testing tools and methodologies are already available. Some companies build there own

40
testing tools that are tailor made for there own development operations. Maintenance Software will definitely undergo change once it is delivered to the customer. There are many reasons for the change. Change could happen because of some unexpected input values into the system. In addition, the changes in the system could directly affect the software operations. The software should be developed to accommodate changes that could happen during the post implementation period.

14. The OPENQRY file:

The Open Query File (OPNQRYF) command is a CL command that allows you to perform many data processing functions on database files. Essentially, the OPNQRYF command acts as a filter between the processing program and the database records. The database file can be a physical or logical file. Unlike a database file created with the Create Physical File (CRTPF) command or the Create Logical File (CRTLF) command, the OPNQRYF command creates only a temporary file for processing the data, it does not create a permanent file. To understand the OPNQRYF command support, you should already be familiar with database concepts such as physical and logical files, key fields, record formats, and join logical files. The OPNQRYF command has functions similar to those in DDS, and the CRTPF and CRTLF commands. DDS requires source statements and a separate step to create the file. OPNQRYF allows a dynamic definition without using DDS. The OPNQRYF command does not support all of the DDS functions, but it supports significant functions that go beyond the capabilities of DDS. In addition, Query/400 can be used to perform some of the function the OPNQRYF command performs. However, the OPNQRYF command is more useful as a programmer's tool. The OPNQRYF command parameters also have many functions similar to the SQL SELECT statements. For example, the FILE parameter is similar to the SQL FROM statement, the QRYSLT parameter is similar to the SQL WHERE statement, the GRPFLD parameter is similar to the SQL GROUP BY statement, and the GRPSLT parameter is similar to the SQL HAVING statement. For more information about SQL, see DB2 UDB for AS/400 SQL Programming Concepts . The following is a list of the major functions supplied by OPNQRYF. Each of these functions is described later in this section. • • Dynamic record selection Dynamic keyed sequence access path

41
• • • • • • • • • • Dynamic keyed sequence access path over a join Dynamic join Handling missing records in secondary join files Unique-key processing Mapped field definitions Group processing Final total-only processing Improving performance Open Query Identifier (ID) Sort sequence processing

To understand the OPNQRYF command, you must be familiar with its two processing approaches: using a format in the file, and using a file with a different format. The typical use of the OPNQRYF command is to select, arrange, and format the data so it can be read sequentially by your high-level language program. See the CL Reference for OPNQRYF command syntax and parameter descriptions.

CRTPF QTEMP/TEST RCDLEN(198) CPYFRMSTMF FROMSTMF('/QOPT/26600/README.TXT') TOMBR('/QSYS.LIB/QTEMP.LIB/TEST.FILE/TEST.MBR') MBROPT(*REPLACE) CVTDTA(*AUTO) ENDLINFMT(*FIXED) TABEXPN(*NO) DSPPFM QTEMP/TEST http://mcpressonline.com/mc?224@164.jLqjbD6xxde.0@b4a97@.214a2c4d Function to center a field. $GetComNam b D $GetComNam pi D LenStr s D ComNum s D ComNam s D TmpComNam s * C if C open C endif * C eval C ComNum Chain C if C eval C endif * C if C close C endif

30a 3 0 inz(0) 3 0 inz(1) 30 inz(*blanks) 30 inz(*blanks) not %open(CCFILEL) CCFILEL ComNum = 001. CCFILEL %found(CCFILEL) TmpComNam = %trim(CCCONM) %open(CCFILEL) CCFILEL

42
* C C C %trim(TmpComNam) * C * P$GetComNam Create user space * Standard API error data structure d ErrorDs DS INZ d BytesProvd 1 4B 0 inz(116) d BytesAvail 5 8B 0 d MessageId 9 15 d Err### 16 16 d Message 17 116 * Name and location of the Output Queue d UserSpace DS d QSName 10 Inz('SPOOL1') d QSLibrary 10 Inz('QTEMP') * Create the user space c c c c c c c c c CALL PARM PARM PARM PARM PARM PARM PARM PARM 'QUSCRTUS' *BLANKS 4096 *BLANKS '*CHANGE' *BLANKS '*YES' UserSpace SpaceAttr SpaceLen SpaceVal SpaceAuth SpaceText SpaceRepl ErrorDs 10 1 10 50 10

eval eval return e

LenStr = ((%len(TmpComNam) %len(%trim(TmpComNam))) / 2) + 1 %subst(ComNam:LenStr) = ComNam

To find the position of the cursor on the display file. File info DS for the DSPF D DSPFInfo DS D LinPos# 370 D RequestDev 197 D SaveLin# S D SavePos# S Select When Eval Eval When Eval Eval When Eval Eval

371B 0 206 3 0 3 0

i_cmd ='SAVE' SaveLin#=LinPos#/256 SavePos#=LinPos#-(SaveLin#*256) i_cmd ='SET ' S0Lin#= SaveLin# S0Pos#= SavePos# i_cmd ='CLEAR' S0Lin#= *zero S0Pos#= *zero

43
Other

15. Questions Bank: AS/400 QS30001 have AS30001 supports 49 QO20002 AO20002 QS20003 AS20003 SYSTEM

What is the Configuration of the AS/400 system on which you worked? System E35(Model 9406), 24MB main memory, 3.2GB of HD and terminals (7 Port). How many terminals can be connected to a port? 7 terminals What do the terms CUA and SAA stand for? Common User Access Systems Application Architecture

QL40004 What are the communication protocols supported by AS/400? AL40004 APPC (Advanced Program to Program Communication) BSCEL (Binary Synchronous Link) ASYNCH (Asynchronous Communication) RETAIL TCP IP FINANCE SNUF SNA Upline facility INTRA Intrasystem communication. QS30005 system? AS30005 What are the different ways of connecting a terminal to a Twinnax, Workstation, ASCII and OS/2 Workstation.

QL30006 Why AS/400 is called an Object Oriented Machine? AL30006 Everything on the AS/400 system that can be stored or retrieved is contained in an Object. Object exist to make users independent of the implementation techniques used in the machine. QS30007 What is SAA ? AS30007 Systems Application Architecture (SAA) is a collection of selected software Interfaces, Conventions and Protocols that will provide a consistent framework across the System/370, AS/400 and PS/2. QS30008 AS30008 What are the different AS/400 rack models supplied by IBM? 9402, 9404 and 9406.

44
QL10009 What are the different high-level languages available on AS/400? AL10009 RPG/400, CL/400, BASIC, PL/1, C/400, PASCAL, FORTRAN/400 and RM/COBOL-85, COBOL/400 etc.. Q1S2001 A1S2001 Q1O2002 A1O2002 Q1S2003 A1S2003 Q1S2004 A1S2004 What are all the IBM Mid range machines prior to AS/400? S/38, S/36, S/34, S/32 &S/3. What is the Operating System on AS/400? OS/400. What are office tasks available on AS/400? Office Vision/400 & PC Support/400. What are the graphic utilities available on AS/400? BGU & GDDM. OS/400 What is the version of OS/400 that you have used? Ver 2.2

QO20010 AO20010

QS40011 What is DDM ? AS40011 Distributed Data Management is a function of the OS/400 that allows an application program or user on one system to use database files stored on remote system. QS30012 What are the facilities available on AS/400 for self-learning? AS30012 on-line education, Q&A Database and Help. QS20013 What is an Object? AS20013 An object is any thing that exist in and occupies space in storage and on which operation can be performed. QS20014 AS/400? AS20014 Queues, What are the different types of Objects available in the Libraries, Folders, Files, Programs, Combined definitions, User Profiles.

QL50015 How are the objects stored in AS/400? AL50015 All objects are stored on AS/400 in a single level storage. In this method all objects are referenced by one virtual address which is translated into a physical address whether it is an auxiliary storage or main memory. QS30016 What is a library in AS/400? AS30016 A library in AS/400 is an object that serves as a repository for other objects. QS20017 AS20017 Name few IBM supplied libraries? QGPL, QTEMP, QUSRTOOL, QSYS, QRPG & QCBL.

QS10018 What is a library list? AS10018 A list that indicates libraries used for the process and the order in which it has to be searched. System identifies it in *LIBL.

45

QO30019 AO30019 QO30020 AO30020

How many libraries can be there in a library list? Total 40 (15 system and 25 application). Where is the system part of the library list stored? In SYSVAL

QS40021 What is a Folder? AS40021 A Folder is a named object that is used as a directory for documents and other folders. Folders can be filed with in another folder. QS20022 What are the different Application Development Tools available on AS/400? AS20022 SEU, RLU, PDM, SDA, QUERY QO30023 AO30023 What are the levels of security on AS/400? 10,20,30,40,50

QS30024 What is error severity? AS30024 Error severity determines the level of severity that is required to terminate the job. QL50025 What is a User Profile? What are the various classes? AL50025User profile is an object which identifies a user to the system. It contains user name, Password, Owned objects, Authorized objects, Scheduling priority, Special authority, Initial program Job description. Security officer, Programmer, Workstation, System operator, Programmer services Rep & Customer engineer. QS40026 What is Group Profile? AS40026 It is similar to User Profile, but the attributes specified is applicable to an entire group. QS20027 AS20027 What are the different types of queues in AS/400? Job queue, Message queue, Output queue, Data queue. PrintQ ? that contains a list of batch jobs by the system. that contains a list of spool files to be printer device.

QL20028 What are JobQ and AL20028 JobQ : An object waiting to be processed PrintQ: An object written to a

QL20029 What is a Spool file? Why is it required? AL20029 A file that holds output data to be processed, such as information waiting to be printed. QL30030 AL30030 What is a Job? What are the attributes of a job? 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? What is job description?

QS20031

46
AS20031 A job description defines the environment in which a batch/interactive job is to be executed. QL20032 What is the difference between Interactive & Batch job? AL20032 Interactive Job: Job started for a person who signon to a workstation. Batch Job: A predefined group of processing actions submitted to the system to be performed. QL30033 What is a Group Job? AL30033A Group Job is attached to one workstation and a user. There should be an initial group job and it can be branched to many other group jobs. The group jobs can have different library lists and different output, message queues. Group Job is useful in enhancing the programmer’s productivity. It is as though logging into the same user-id many times. QO20034 of a job? AO20034 What are the two main attributes which govern the execution Run time priority and Time slice.

QL20035 What is a sub-system? AL20035 Sub-Systems are specific user defined partitions of the CPU where various jobs may be executed. One subsystem can have more than one active job at a time. QL20036 What is a device file? AL20036 A device file contains the description of how data is to be presented to a program from a device or vice versa. Device file can be Printer, Disk, Tape or Remote system. QS30037 AS30037 communicate other What is an ICF file? A device file that allows a program on the system to with program in system.

QS30038 What is a message file? AS30038 It is a file which contains the messages of an application. For example all RPG/400 messages are stored in a file; all COBOL/400 messages are stored in a file. QL30039 What is a job log? AL30039 A record of request submitted to system is a job. The message related to the requests, and the action performed by the system on the log. It is maintained by the system program QL20040 What is the purpose of OPNQRYF (Open Query File)? AL20040 OPNQRYF is used to select certain records of the database file based on the QRYSLT (Query select) condition. QS10041 AS10041 How do you create files dynamically without DDS? through OPNQRY.

47

QO10042 command? AO10042

What command must be executed before executing OPNQRYF OVRDBF.

QL30043 What is a data area? AL30043 A data area is an object used to hold data for access by any job running on the system. A data area can be locked to a single user, thus preventing other users from processing at the same time. QS20044 What are the types of data areas? AS20044User defined Data Area, Local Data Area (LDA), Group Data Area (GDA), and Program Initialization Parameter (PIP) Data Area. QS20045 What is LDA? AS20045 An LDA is created by the system for each job in the system, including autostart jobs, jobs started on the system by a reader, and subsystem monitor jobs. QS10046 AS10046 What is the type and length of an LDA? *CHAR, 1024 bytes.

QS20047 What is GDA? AS20047The system creates a GDA when an interactive job becomes group jobs.Only one GDA can exist for a group. QS10048 AS10048 How can you create a user defined data area? Using CRTDTAARA command.

QS10049 What are the different ways to input data into a data area? AS10049 CHGDTAARA (using CL) Using OUT opcode in RPG QS10050 AS10050 QS10051 AS10051 QS20052 AS20052 How do you retrieve data from data area? Using RTVDTAARA command in CL Using IN opcode in RPG. What are the valid user defined data area types? CHAR, NUMARIC and LOGICAL. How can a data area are locked after being updated? Using OUT *LOCK.

QS20053 what is the use of data queues? AS20053 Data queue is a type of system object that you can create. Data queues are used in program to program communication. QO10054 AO10054 QS10055 AS10055 QS20056 AS20056 How do you create data queues? Using CRTDTAQ command. What are the valid data types for a data queue? Char, Numeric, and Logical. What are the two types of read performed on data queues ? Read with lock, and read without lock.

48

QS20057 AS20057

How do you use DEBUG utility ? STRDBG program-name UPDPROD(*YES)

QS30058 What is an authorization list ? AS30058 A list of two or more user Ids & their authorities for system resources. The system identifies it as an object type *AUTL. QO10059 AO10059 How do you grant authority for an object? Using GRTOBJAUT command.

QL30060 What are the types of object authorities ? AL30060 *USE, *CHANGE, *ALL, *EXCLUDE, *AUTL, *OBJEXIST, *OBJMGT, *OBJOPR, *ADD, *DLT, *READ, *UPD. QO20061 AO20061 How do you execute jobs in batch mode? SBMJOB

QL40062 What is the use of OVRDBF ? AL40062 You can use the Override with Database file (OVRDBF) command to replace the database file named in a CL program or to change certain parameters of the existing database file. QL30063 What is the use of OVRPRTF ? AL30063 Override with Printer file (OVRPRTF) command is used to override certain parameters of the printer files used in the program or to replace the printer file. QO30064 How do you change file attributes such as size, file wait time, record wait time etc., permanently ? AO30064 Using CHGPF command. QO10065 AO10065 QS30066 AS30066 session. What is the purpose of CRTCMD ? To create user defined command. What is class of service ? A set of link and node characteristics associated with a

QO10067How to see active jobs of the system ? AO10067 Using WRKACTJOB command. QS30068 AS30068 How do you detect unused spool storage ? Using Reclaim Spool Storage.

QS50069 What are the functions of Remote Job Entry (RJE) ? AS50069 Allows user of AS/400 system to submit jobs and receive jobs from a host system. QL50070 What is the function of RJE Conversion Utility ? AL50070It converts compressed data written to an AS/400 database file to decompressed data written to another AS/400 database, diskette, or device file. QS40071 AS40071 What is the function of the SBMRJEJOB command? Sends RJE input stream to host system.

49

QL40072 What is journaling and commitment control? AL40072 Journaling is a function which records the changes in a file in a journal. These record images are used to recover the changes in the file should the system ends abnormally. Commitment control is a function that allows you to define and process a no of changes to database files as a single unit (transaction). QS30073 AS30073 led. QS40074 AS40074 Q2S4001 A2S4001 S/38. What is the purpose of STRCMTCTL command ? Starts commitment control for files that are being journal What are the system objects required for journaling? Journal receiver, journal and PFs to be journal led. What is CPF ? Control Program Facility (CPF) is an operating system on

Q2S4002 What is invocation stack ? A2S4002List of programs maintained by the system as one program calls another in a series of calls within a single task or job. Q2S3003 What is time slice ? A2S3003A finite amount of time in which a job is granted system resources while other jobs are queued. Q2S4004 What is IPL ? A2S4004Initial Program Loading (IPL) is run by OS/400 when the system is started. Q2S3005 What does V2R2M0 mean ? A2S3005Ver. 2, Release 2 & Modification level 0. This refers to the version of OS/400. Q2S3006 Name the commands used to duplicate a file? A2S3006CPYF - Copy File & CRTDUPOBJ - Create Duplicate Object. Q2S3007 Name the command for changing the attributes of a spool file? A2S3007CHGSPLFA - Change Spool file Attributes. Q2S3008 Name the command which gives the attributes of a job ? A2S3008RTVJOBA - Retrieve Job Attributes. Q2S2009 What is the function of PDM ? A2S2009Productivity tool for copying, deleting, scanning, changing & creating source files. Q2S2010 What is the function of SEU ? A2S2010A utility for editing programming language source code.

50

DATABASE FILES QL30075 What are the different definition levels in Data Description specifications ? AL30075 File level, Record level, Field level, Join level, Keyfield level, Select/Omit level. QL30076 What is difference between Source Physical File and Physical File ? AL30076 A Source Physical File contains the source for the various objectscreated. This file has a specific structure. A Physical File contains data, and the record format can be different for different physical files. QS20077 What is the difference between Physical and Logical files ? AS20077 Physical file contains data, where as Logical file serves as a access path to database. QS20078 What is an access path ? AS20078 The order in which the database fields are organized for processing in the program. QS30079 AS30079 What are all the different types of access paths ? Arrival sequence access path, Keyed sequence access path.

QS30080 How many record formats can you have in a Physical file and in a Logical file ? AS30080 Physical file can contain only one record format, Logical file can contain more than one record format. QS20081 What is a field reference file ? AS20081 A field reference file is a physical file which contains no data, contains field description. this is used as a reference file by other physical files. QO20082 What is the default value for the number of increments for the physicalfile ? AO20082 Three. QS10083 AS10083 When is the DFT keyword in PF used for? To specify the default value it a field.

QS20084What is Multi-format logical file ? AS20084 Logical which uses fields from two or more physical files. QL30085 What is dynamic select ? AL30085 Selection and omission of LF records performed during processing, instead of access path is maintained. This can be used when key access path does not exist. QL20086 What is the Select and Omit criteria in logical file ?

51
AL20086 This is used to specify rules for the Selection/Omission of records from a Physical File. QS20087 AS20087 QS30088 AS30088 Can fields be concatenated at the logical file level ? Yes, by using CONCAT keyword. When would the ALL keyword be used ? Use with Select or Omit, to select/omit records.

QS30089 What is a Join Logical File, Can it be used for Update ? AS30089 Logical file that combines more than one physical file.Update is not possible through JLF. QL30090 How many files can be joined at a time, What is the max. no. of files ? AL30090 At a time you can join two files. The max. no. of files is 32.Only one primary file and the remaining are secondary files, The primary file and at least one secondary file must be physical files. QO20091 AO20091 Is it possible to join the same file to itself ? Yes.

QS10092 What is FCFO, FIFO, LIFO in Database environment ? AS10092These are file level keywords which are used to access the records in the order FCFO : First Changed First Out FIFO : First In First Out LIFO : Last In Fist Out QL40093If a file layout is changed, how do you generate new PF and retain data? AL40093Copy the file and change the structure of Physical file, later copy old file with drop option. QS50094 What is the overhead on logical file ? How can it be improved ? AS50094 Maintaining access path and storage space. We can improve the performance by using *DELAYED, *REBUILD keywords to enhance the speed. QS40095 logical AS40095 How can the sign of a numeric be ignored when sequencing a file ? By specifying the record level keyword UNSIGNED.

QS40096 If a field references a field that has an EDTCDE or an EDTWRD keyword specified, can the EDTCDE or EDTWRD from the referenced field ignored ? AS40096 Yes, by using DLTEDT keyword. Q3S2001 What does the keyword UNIQUE mean ? A3S2001Records with duplicate key values are not allowed. Q3S4002 State three different methods of maintaining access paths ? A3S4002Immediate, Rebuild & Delay.

52
DISPLAY FILES QS20097 AS20097 What are the different types of keywords in display files ? File level, Record format level, Field level.

QO30098 What is the maximum number of records you can specify in a display file ? AO30098 1024. QS40099 How can a screen field that has changed since the last output operation be detected ? AS40099 Attach the MDT attribute to the field, to detect whether field has been changed as a result of user input. QS50100 What would be the effect on the field where reverse image, underline and highlight display attributes are active ? AS50100 The result is same as if you had specified ND. QL40101 What is the use of DSPATR(MDT) keyword ? AL40101 Sets on the modified Data Tag of the field. This Data Tag detects whether the field has been changed as a result of user input. QO30102 A030102 If DSPATR(PC) and CSRLOC were specified for a format, which keyword would have priority ? CSRLOC gains priority.

QS40103 Can error messages as a result of a COMP, RANGE or VALUES keyword be overridden ? AS40103 Yes, through CHKMSGID keyword. QL40104 What is the purpose of OVRDTA and OVRATA keywords ? AL40104 OVRDTA keyword (field or record level) can be used to override the existing data contents of a field or record already on the display. OVRATA keyword (field or record level) can be used to override the existing display attributes of a field or record already on the display. QS30105 How can a message from a message file appear as a constant on the screen ? AS30105 By using MSGCON (message constant) keyword. QS30106In conjunction with what other keyword must OVRDTA and OVRATA be used ? AS30106 PUTOVR keyword must be used. QS50107 How can a field that is larger than what could fit onto one line be truncated from the last blank rather than from the last character position? AS50107 Using BLKFOLD keyword. QS40108 What is the purpose of the INDARA keyword ? AS40108This File-level keyword is used to remove option and response indicators from the buffer and places them in 99-byte separate indicator area.

53
QL40109 Explain the purpose of KEEP and ASSUME keywords ? AL40109 KEEP : Keep the display from being deleted when the display file is closed. ASSUME : It is used to specify that the OS/400 program is to assume that this record is already shown on the display when this file is opened. QS30110Explain the use of DFRWRT display keyword ? AS30110 No records will be displayed until there is an I/O operation. QS30111 AS30111 next I/O QS10112 AS10112 QS30113 ? AS30113 What is the purpose of FRCDTA keyword ? Immediately display a record format without waiting for the operation. What keyword must be used with PROTECT keyword ? OVERLAY Where is the variable for the SLNO(*VAR) keyword be defined At run time before displaying the record format.

QS50114Under what conditions would a field where the ERRMSG keyword was active would not be displayed in reverse image ? AS50114 If it is an output-only field or input capable field with display attributes UL, HI are active. QS50115 When will the message for field that has the ERRMSG keyword active not be displayed ? AS50115 If more than one ERRMSG keywords are active then the first will be active, because only one error message will be displayed at a time. QL50116 What is CHGINPDFT keyword, and what will be the effect if you define this keyword at file with out any parameter values ? AL50116 This file, record or field level keyword is used to change one or more input defaults for input capable fields. If you define this keyword at file level without any parameter then the underline will be suppressed. QS30117 In what case control will be passed back to the program when the last character of the field is keyed ? AS30117 CHECK(ER) ER - End of Record. SUBFILES : QL10118 What is a subfile ? AL10118 Subfile is a group of records of same record format and can be read from or write to the display in a single operation. QL30119 What are the contents of subfile ?

54
AL30119 Subfile Record Format, Subfile Control Record Format, Relative Record Number, Subfile Record Number, Associated Subfile Keywords. QS20120 What are the two record formats that a subfile contains ? AS20120Subfile record format(SFL), and subfile control record format(SFLCTL). QL30121 What is SFLPAG and SFLSIZ ? AL30121 SFLPAG : it is an attribute which specifies the number of records that can be displayed in a screen. SFLSIZ : it is an attribute which specifies the number of records can be stored in the subfile. QO30122What is the maximum number of subfiles that can specified in a display file ? AO30122 512 QO30123 The maximum number of subfiles that can defined in a RPG program for one display file is ___ . AO30123 24 QO30124 The maximum number of subfiles that can be active for a single file is____ . AO30124 12 QL20125 What are the different opcodes used for file operation on a subfile in a RPG Program ? AL20125READ, READC, CHAIN,UPDAT and WRITE QS30126 AS30126 Can more than one subfile record be displayed on one line ? Yes, by using SFLLIN keyword.

QS30127 How do you specify the number of records to roll in a subfile ? AS30127 Use SFLROLVAL keyword in DDS along with the number, which specifies the number of records to scroll at a time. QL30128 How will you display a particular page in subfile ? AL30128 Move a valid relative record number(RRN) in the field specified using SFLRCDNBR keyword in DDS. QS30129 after the AS30129 record. How to pick up the changed records every time in a subfile first change made ? Seton SFLNXTCHG keyword indicator and update the subfile

QS30130 What is the use of the SFLEND keyword ? AS30130 By specifying this keyword, the Bottom/More message could be displayed at end of screen. QS30131 How do you toggle between single line and multi-line display of a particular record in a subfile ? AS30131 Using SFLDROP keyword. QL40132 Explain the difference between defining Subfile and Message-subfile ?

55
AL40132 A subfile record is defined by SFL keyword, whereas a message subfile is defined by SFLMSG keyword. QO30133 Can a single screen format occupy a screen area above and below a subfile format ? AO30133 Not possible. QS50134 How can a program be prevented from failing over when READC is performed on an empty subfile ? AS50134 Check indicator placed in position LO, which will be seton if EOF if reached. CONTROL LANGUAGE (CL/400) QO10135How to start a CL program ? AO10135 PGM. QO20136 AO20136 How many files can be declared in CL ? One.

QO30137 Which precedes, the file declaration or variable declaration ? AO30137 Variable declaration and then File declaration. QS10138 AS10138 QO10139 AO10139 QO10140 AO10140 QO20141 AO20141 What are the different types of variables available in CL ? DEC, CHAR, LGL In CL Program '&' precedes ____ . Variables. How do you pass parameters in CL ? Using PARM keyword. Can libraries be added to the library list through CL ? Yes, using ADDLIBL.

QL50142 What is the difference between CAT, TCAT and BCAT ? AL50142 CAT : Concatenate two variables or constants into one continuous string. BCAT : Truncates all trailing blanks in the first character string ; one blank is inserted , then the two character strings are concatenated. TCAT : Truncates all trailing blanks in the first character string, thetwo character strings are concatenated. QO10143 AO10143 QS30144 AS30144 message. QS30145 AS30145 QO30146 How do you end a CL program ? ENDPGM What are the different types of messages in CL ? Immediate message, Break message, Program message, User How can errors be trapped in a CL program? By using Monitor Message Command ( MONMSG ) What is the maximum length of a variable name in CL ?

56
AO30146 QL50147 AL50147 Maximum 11 characters (including '&')

What are the limitations of CL (compare to RPG) ? You cannot use CL program to : . ADD or UPDATE records in database files . Use Printer or ICF files . Use Program described files . Use the concept of subfile (to display more than one record), but a single output message subfile is a special type of subfile that is supported well in CL . Use subroutines. You cannot declare more than one object (file) in a CL programme. RPG/400 QS10148 AS10148 What is RPG ? Report Program Generator. Can

QL30149 What are the positive points of RPG Language ? AL30149 Contains opcodes which makes it flexible with OS/400 access the externally described file. QL50150 AL50150 Explain RPG Program Logic Cycle ?

START

Perform detail calculation Perform header, detail output Read a record Set ON LR if EOF If change in control field, set ON control level indicators.

Move data from selected record into processing area

Perform total calculations Perform total output If LR is ON then END program

QS30151 When is it efficient to make use of RPG Cycle ? AS30151 When the file is arranged in sequence and output is based on control break. QS20152 in some AS20152 Can you call a program in your RPG program, which is coded other language? Yes, Any program object available on AS/400.

57
QL20153 RPG/400 ? AL20153 What are the different types of specification available in Control Spec.( H ) File Spec.( F ) Extension Spec.( E ) Line counter Spec.( L ) Input Spec.( I ) Calculation Spec.( C ) Output Spec.( O )

QO40154 Is it necessary to define all formats? Which are mandatory and which are Optional? AO40154 No, all are Optional. QS20155 What is the use of H spec. in RPG ? AS20155 It identifies by H in column 6, Provides information about generating and running programs. QS50156 AS50156 When will DUMP and DEBUG opcodes be ignored ? If blank is specified in position 15 of H specs.

QS20157 What are the valid file types ( position 15 ) in F specification ? AS20157 I(Input file). O (Output file). U (Update file). C (Combined (I/O) file). QL40158 Specify different indicators used in RPG ? AL40158 Overflow indicators. Record Identifying Indicators. Field Indicators. Resulting Indicators. Control Level Indicators. QL40159 What are Control level indicators ? AL40159L1 to L9 used to identify certain fields on control fields and then used to condition which operations are to be processed at detail or total calculation or output time. QS20160 What is the use of E specification in RPG ? AS20160 Extension Specs describes all record address files, arrays and tables. QS30161 What is the use of L specs in RPG ? AS30161Line counter specification can be used to describe printer file to indicate the length of the form and number of lines per page. QS10162 AS10162 QO30163 AO30163 In which specification can a report layout be defined ? O Specification. How many files can be defined in F specs ? A maximum of 50 files.

58
QO30164 AO30164 How many printer files can be defined in F specs ? A maximum of 8 files.

QS20165 Give three main purposes of File specification ? AS20165 To define files, to describe the files, to assign the files to specified devices. QS20166 How do you specify page overflow indicator for printer files in RPG ? AS20166 Specify an indicator in positions 33-34 of F specification. QS20167 What is a Primary File ? AS20167 It is used in RPG Program Cycle to automatically read records in a cycle. QO30168 program ? AO30168 QS20169 AS20169 the RPG Can an indexed file be accessed in arrival sequence in RPG Yes. What is a program described file in RPG ? The field name and length of the fields are defined with in program.

QS20170 What is an externally described file ? AS20170 All information about the fields is specified in DDS and the RPG program can use them with in the program. QO30171 Can you specify a display file to be used in the following modes:Input, Output or Combined modes? AO30171 Yes. QL40172 What are match fields indicators ? AL40172 Matching record indicator is seton when all the matching fields in the record of a secondary file matches with all the matching fields of a record in a primary file. QO20173 AO20173 QS10174 AS10174 QS10175 AS10175 What is the length of a variable in RPG ? 6 Characters. What are the different arithmetic Opcodes ? ADD, SUB, MULT, DIV, MVR, SQRT, XFOOT, Z-ADD, Z-SUB. When is a TAG statement used in RPG ? It is used as a Label.

QL30176 What are the different Opcodes available in RPG for Database access ? AL30176READ, CHAIN, WRITE, UPDAT, DELET, SETLL, SETGT, READE, READP, REDPE, OPEN, CLOSE, FORCE, NEXT, UNLCK. QS10177 What is READP opcode ? AS10177 Read previous record. QS10178 AS10178 QO30179 What is REDPE opcode ? Read Prior equal record. How do you check if a division was whole division ?

59
AO30179 Check the EQ indicator be set to '1' to test an alphanumeric field

QO30180 What opcode could be used for all numeric values? AO30180 TESTN. QO30181 field ? AO30181

What opcode will be used to test the zone of a character TESTZ.

QS40182 How do you specify Half Adjust ? AS40182It should be specified in the column 53 of C specs as 'H' to indicate half adjust. It will be effective only if the resultant value is having more decimals than the result field. QL30183 Explain the difference between READ, CHAIN and SETLL ? AL30183 READ operation reads the record currently pointed to, from a full procedural file. CHAIN operation retrieves a record from a full Procedural file, sets a record identifying indicator ON and places the data in the input fields. SETLL operation position a file at the next record that has a key or relative record number that is greater than or equal to the search argument specified. The file must be fully procedural for all three opcodes. QL30184 What does LO and EQ indicators signify in READ, WRITE and CHAIN operations ? AL30184 LO indicator specifies the error status on the above operations.EQ indicator specifies the EOF, Record not found. QS30185 AS30185 How can database records be read without lock ? Put 'N' in position 53 of C specs.

QL20186 What is the difference between MOVE and MOVEL ? AL20186 MOVE operation will transfer characters from the factor 2 to the result field, the move starts from rightmost character of factor 2.MOVEL operation will transfer characters from factor 2 to the result field, the move starts from leftmost character of factor 2. QS20187 AS20187 QL30188 AL30188 QS10189 AS10189 string. QS20190 How do you concatenate two string variables in RPG ? Using CAT opcode or with MOVE followed by MOVEL. What are the string operations possible in RPG/400 ? CHECK, CHEKR, SUBST, CAT, XLATE, SCAN. What does SUBST do ? Extracts a specified character string from a base character What does CHECK opcode do ?

60
AS20190The check operation verifies that each character in the base string (factor 2) is among the character indicated in the comparator string(factor 1). QS10191In conjunction with which statements can ORxx and ANDxx conditions be used ? AS10191 DOUxx, DOWxx, IFxx, and WHxx. QS10192 What is the difference between DOU and DOW ? AS10192 DOU checks after entering into the loop, it is performed at least once.DOW check before entering into the loop. QL20193 What is ITER and LEAVE opcodes do ? AL20193 ITER transfers control from within a DO group to the ENDDOstatement of the DO group. It causes the next iteration of the loop to be executed immediately LEAVE operation transfers control from within a DO group to thestatement following the ENDDO operation. QL20194 Which instructions support structured programming in RPG ? AL20194 ANDxx, CASxx, DO group, ELSE, ENDyy, IFxx, ITER, LEAVE, ORxx, OTHER, SELEC, WHxx. QS10195 AS10195 What does 'SR' in columns 7-8 of C specs mean ? Calculation operation is a part of RPG subroutine.

QL20196 Explain CASxx, and CABxx statements ? AL20196 CASxx operation allows you to conditionally select a subroutine for processing. The condition is based on the relationship between factor 1 and factor 2 as specified by xx.If the relationship is true the subroutine specified in the result field is processed. CABxx operation compares factor 1 with factor 2 , if the condition specified by xx is true, the program branches to the TAG operation associates with the label specified in the result field. QL30197 What is CLEAR and RESET ? AL30197CLEAR operation sets the elements in a structure (record format, array/table, data structure) or a variable (field, subfield or indicator) to zero , blank or '0' depending on the field type (numeric, character, indicator) RESET operation sets the elements in a structure (record format, array/ table,data structure) or a variable (field, subfield or indicator) to its initial value. QL40198 What is SCAN and XLATE ? AL40198 SCAN operation scans a character string (base string) contained infactor 2 for a substring (compare string) contained in factor 1.

61
XLATE operation translates characters in source string (factor 2) from and to strings(factor 1) and put into the result How do you use commitment control in RPG program ? Using COMIT operation. Makes all changes to the files that have been specified in output operation since the previous COMIT or the beginning of operations under commitment control(if there has been no previous COMIT or ROLBK operation). How do you use exceptional write in C specs ? Using EXCPT opcode.

to the field.

QL40199 AL40199

QS30200 AS30200

QL30201 What does the opcode FREE do ? AL30201 The FREE operation removes a program from the list of activated programs, frees static storage and ensures program initialization (first cycle processing) the next time program is called. It does not close file or unlock data area. QS30202 AS30202 What does opcode POST do ? Puts information in IFNDS.

QS20203 What is the difference between WRITE and EXFMT of a display file ? AS20203 WRITE displays a record format on workstation, EXFMT displays and accepts from the workstation. QS20204 What is the difference between PLIST and KLIST ? AS20204PLIST operation defines a unique symbolic name for a parameter list to be specified in a CALL operation. KLIST is a declarative operation that gives a name to a list of key fields QO30205 AO30205 QS40206 AS40206 Can you have multiple key lists for a single file ? Yes. What are the different types of arrays available in RPG ? Pre-execution time array. Compile time array. Execution time array.

QL40207 How do you specify data for a compile time array ? AL40207You can specify in E specs about the no of entries per record, no of elements, length of each element with the corresponding data entered at the end of the RPG program starting with **. QO30208 AO30208 QO30209 AO30209 What is the maximum number of elements in an array ? 9999. Can we define Multi-dimensional arrays in RPG ? No.

62

QS20210 AS20210 sum in the QS20211 AS20211

What is XFOOT opcode ? Adds all the elements in a numeric array, and places the result field. How can we sort an array ? By using SORTA opcode.

QS20212 What is MOVEA opcode do ? AS20212 Transfer character to numeric values from factor 2 to result field. MOVEA can be possible to ARRAY-ARRAY, ARRAY-FIELD, or FIELD-ARRAY. QS20213 AS20213 QS20214 AS20214 table. QS20215 AS20215 How to initialize an array ? CLEAR or MOVEA *blanks to array. What is LOKUP opcode do ? LOKUP opcode search for a particular element in an array / Can LOKUP operation be used for unsorted array? Yes.

QL20216 What is the difference between an array and a table ? AL20216 An array elements can be referred by array name.Elements in array can be accessed by their position relative to other elements. Table name does not refer to the entire set of table elements. Elements in a table can not be accessed by their position relative to the other elements. QO30217 AO30217 QO20218 AO20218 What is the maximum length of a table name ? 6 characters. What is the syntax of a table name ? Table name should start with TAB.

QS30219 How can the user implicitly open and close the files in RPG program ? AS30219 Enter UC in position 71-72 of F specs.Use OPEN and CLOSE opcodes in RPG program to open and close files. QO20220 During input operation which indicator position is seton if there is a record lock? AO20220 LO indicator position is seton. QS20221 What is the significance of DEFN opcode on RPG ? AS20221 To define fields based on the attributes of another field. To define a field as a data area. QS20222 field ? AS20222 QO30223 AO30223 What are different ways by which you define working storage Explicitly define or use *Like DEFN. How many parameters can be defined in a RPG program? Max. 255.

63

QL40224 What are the different ways of ending an RPG program without a primary file ? AL40224 SETON LR. SETON H1 to H9 (halt indicators). SETON RT. RETRN. By allowing an exception / error to end the program if . No exception / error subroutine is specified . No return point is specified on an exception or error subroutine . The user's response is to cancel the program. QL40225 Specify different ways by which RPG program can give error message to user? AL40225 By calling the SUBR23R3 program as passing message id. By defining the error message in DSPF. QL50226 If you are trying to add a record in a file and an error is displayed,where do you look for error ? AL50226 Check whether you have opened the file in Update mode.Check whether you have specified 'A' in position 72 of F specs. QL50227 What is a File Information Data Structure ? AL50227 File Information Data structure (INFDS) can be defined for each file tomake file exception/error information available to the program. A file information data structure contains predefined subfields that identify: . The name of the file for which the exception/error occurred . The record being processed when the exception/error occurred or the record that caused the exception/error . The last operation being processed when the exception/error occurred . The status code . The RPG routine in which the exception/error occurred. QL50228 What is Program Status Data Structure ? AL50228 A program status DS can defined to make program exception/error information available to an RPG program.DS is defined as a program status DS by an S in position 18 of the DS statement. *STATUS contains status code *ROUTINE contains name of routine in which the exception/error occurred. *PARMS contains the number parameters passed to this program from the calling program. Specify heading information/TITLE. Specify to begin on a fresh page/EJECT. To control line spacing/SPACE. Records to be inserted from other files at the point where it is specified/COPY. QO30229What is the maximum no. of times multiple occurrence DS can occur in a program ? AO30229 9999.

64

QL30230 What is the difference between *LIKE and *NAMVAR ? AL30230 *LIKE defines the variables as in database. *NAMVAR is used to define variables as data area. QL30231 AL30231 How is embedded SQL used in RPG ? /EXEC SQL + SQL statements + -------------------+ -------------------/END EXEC What are all the compiler directive statements ? /TITLE, /EJECT, /SPACE, /COPY.

QS30232 AS30232

QS40233 How can RPG program send message to System Operator ? AS40233 Use QCMDEXC as called program in the CALL statements, and use SNDPGMMSG to the operator. QL50234 AL50234 Where DBCS data will be used in RPG ? In any comment statement . In comment field of E and C Specs . In literals and constants . As data in any character field, subfield, array or table. Where will control be passed after the execution of the subroutine if the factor 2 of the ENDSR is Control will return to the next sequential instruction.

QS40235 *PSSR blank ? AS40235

QS40236 How can the CPF error-id be retrieved when a program error occurs ? AS40236 CPF error codes are placed in the subfield location *STATUS for the program status DS. QS30237 How could indicators 50 to 99 be set to '0' in one instruction ? AS30237 Using 'MOVEA *ZEROS IN,50' . QL30238 What are the figurative constants ? AL30238 *BLANK/*BLANKS, *ZERO/*ZEROS, *HIVAL, *LOVAL, *ALL 'X..' are implied literals that can be supplied without a length, because the implied length and decimal positions of a figurative constant are The same as those of the associated field. QO30239 What is the maximum error severity for which the compilation of RPG program stops? AO30239 50, if LR is not seton. Q6S2001 What are the earlier versions of RPG ? A6AS2001RPG II & RPG III. Q6L4002 entered ? Name the different ways by which RPG source program can be

65
A6L4002Interactively with SEU, In batch by using either OS/400 or Spooling functions. Q6O3003During input operation which indicator position is seton if the record is locked ? A6O3003Position 56 - 57 (LO). Q6O5004 What is the record lock status value ? A6O5004Status value is 01218. MISCELLANEOUS QO30240 AO30240 QO30241 AO30241 How do you combine two record formats in RLU ? Using CLC. How do you split record formats in RLU? Using CLR.

QO20242 What is the use of SDA? AO20242 Screen Design Aid is used to create display files interactively. QO40243 AO40243 QS40244 AS40244 QS30245 AS30245 How do you define overlapping fields in SDA ? They can be defined through condition indicators. Mention different ways of specifying user help. Through SDA and Panel Group. To which member type does help text for panel belong ? PNLGRP

QO20246 Can Printer files be externally described or program described ? AO20246 Yes. QS20247 AS20247 What are the valid file operation codes for a PRINTER file ? WRITE, OPEN, CLOSE, FEDO.

QS50248 If you use INDARA keyword for a program-described PRINTER file, what will be the result ? AS50248 You will get run-time error. QL50249 What is PRTCTL, and where will you define it ? AL50249 The PRTCTL (Printer Control) option allows you to change forms control information and to access the current line value within the program for a program-described PRINTER file. PRTCTL option will be specified on a F specifications continuation line for the PRINTER file. Q8S2001 What is the function of RLU ? A8S2001To design & prototype a report. Q8S2002 What are the three types of keywords associated with printer file? A8S2002File level, Record level & Field level. Q8S2003 What are the three line types in RLU ?

66
A8S2003Report line, Filler line & Sample line. Q8O1004 Which option number is used to invoke RLU ? A8O1004Option 19. Q8L4005 What are the different commands used A8L4005DR - Define Record, CLC - Change Line for Change Line for Record, SD - Create Sample Data, VF - View DC - Define Constants, DF - Define Fields, CF - Centre Fields evenly. Q8O1006 A8O1006 Q8S1007 A8S1007 in RLU ? Continuation, CLR Fields, NP - New Page, Fields & SP - Space

What is the command used to invoke RLU ? STRRLU. What are different record spacing keywords in RLU ? SKIPA, SKIPB, SPACEA & SPACEB.

Q8L4008 What is job description ? A8L4008A job is an unit of work on the AS/400. Jobs run in a subsystem using system resources viz. memory, disk, etc. A job can be either interactive or batch. For interactive jobs JOD in User profile is used and for batch jobs JOBD along with SBMJOB is submitted with an object type of job description is *JOBD. Job description is a set of characteristics that define how the system handles a job. It contains: Job queue (only for batch), job priority, printer to be used, OUTQ & its priority, time slice & run priority. If none of the above is specified the system used the default job description. Q8L4009 Define a sub system? A8L4009Sub system is an operating environment, defined by a sub system description. All user jobs are processed in the sub system. Eg.QBASE, QBATCH, QCTL, QINTER, etc. Sub system description defines the characteristics of a sub system. ROUTING ENTRY: Specifies the program to be called to control a routing step. WORK ENTRY: Source from which jobs can be accepted. WORK STATION ENTRY: Display stations from which users can log into the sub system. Q8L4010 Open query file [OPNQRYF]? A8L4010Open query file (OPNQRYF) selection can be on: * Dynamic record selection * Dynamic keyed sequence * Dynamic join * Unique key processing * Group processing

67
* Final total processing * Improve performance Query access path will be implemented through the following * * * CL program containing an OPNQRYF to open access path at runtime OS/400 physical file used to compile programs [dummy PF] used at runtime OS/400 logical file defines the key to OPNQRYF command

objects

Q8L4011 Override database [OVRDBF] ? A8L4011Override database [OVRDBF] lets to override the filenames or attributes of file selected when we compile/run program. Overrides can be used to change most of the attributes. To cancel the override database command we shall have to give delete override databases DLTOVR. Q8L4011 How do you pass numeric parameters for submit job? A8L4011Convert numeric parameters to character and pass, or.pass in hexadecimal format(x’0nf’ if ‘n’ contains odd number of digits x’nf’ if ‘n’ contains even number of digits) APPENDIX - A The coding methodology to be followed to code questions & answers that are to be added to this question bank is described below. CODE STRUCTURE : ABCDnnn.

A - A indicates whether the code is a question or an answer. The possible values are: Q - Question. A - Answer. B - B indicates the topic under which the question/answer falls. The possible values are: 1 2 3 4 5 6 7 8 AS/400 SYSTEM. OS/400 DATABASE FILES DISPLAY FILES CL/400 RPG/400 COBOL/400 MISCELLANEOUS

C - C indicates the question/answer type. The possible values are: O - Objective type. S - Short answers. L - Long answers.

68

D - D indicates the complexity level of the question/answer. The possible values are: Complexity levels 1/2/3/4/5 (Where complexity level increases from 1 - 5) nnn - These represent the numeric sequence. SQLRPG Statements: C+ SELECT MIN(G4EDAM) INTO :WUAMT1 FROM G4AGEDP WHERE G4EDCD = C+ :A1EDCD AND G4EMGR = :WUGR01 C/END-EXEC * * C/EXEC SQL C+ SELECT MAX(G4EDAM) INTO :WUAMT2 FROM G4AGEDP WHERE G4EDCD = C+ :A1EDCD AND G4EMGR = :WUGR01 C/END-EXEC * C/EXEC SQL C+ SELECT AVG(G4EDAM) INTO :WUAMT3 FROM G4AGEDP WHERE G4EDCD = C+ :A1EDCD AND G4EMGR = :WUGR01 C/END-EXEC * C/EXEC SQL C+ SELECT MIN(G4EDAM) INTO :WUAMT4 FROM G4AGEDP WHERE G4EDCD =

Table 33. Built-In Functions Name Arguments Value Returned Function %DATE {value {: date format}} the date that corresponds to the specified value,or the current system date if none is specified

Example Syntax :- %DATE(expression :{Date Format}) Description :- This Built in function converts value from Character, numeric or time Stamp to Date Example :D String S inz(‘04/05/96) D Fld1 S inz(112001) D Date S datfmt(*ISO) 8A 6P 0 D

69
D TimeStam /free :*MDY); 1996-04-05 :*MDY); 2001-11-20 S Z

Date = %DATE(String // Date now contains Date = %DATE(Fld1 // Date now contains

%DAYS number of days number of days as a duration

Clear TimeStam; Date = %DATE(TimeStam); // Date now contains 0001-01-01 /end-free Syntax :- %DAYS(Number) Description: - This built in function converts a number into a duration that can be added to a date or time Stamp Example :D Date1 S D inz(D’2001-11-20’) D Result S D /free Result = Date1 + %DAYS(15); // Result is now 200112-05 Result = Date1 %DAYS(10); // Result is now 200111-10 /end-free

%DECH numeric expression :digits:decpos half-adjusted value in packed numeric format

Syntax :- %DECH(numeric expression :precision :decimal places) Description: - This built in function is same as %DEC except that if numeric expression is a decimal or flat value than half adjust is applied to the value of numeric expression when converting to the desired position.

Example :D Fld1 S inz(73.73642)

9s 5

70
D Result /free :2); S 15p 5

Result = %DECH(Fld1 :5

%DIFF date or time expression: date or time expression: unit difference between the two dates, times, or timestamp in the specified unit

// Result is now 73.74000 /end-free Syntax :- %DIFF(Op1 :Op2 :*MS| *s| *MN| *H| *D| *M| *Y) Description: - This Built in function calculates difference (Duration) between two date or time values. The first and second parameter must have the same or compatible type. The following Combination are possible :Date and Date Time and Time TimeStamp and TimeStamp Date and TimeStamp Time and TimeStamp Example :D Date1 S D inz(D’2001-1120’) D Date2 S D inz(D’2001-1015’) D Time1 S T inz(T’12.30.54’) D Time2 S T inz(T’01.30.54’) D Result S 15p 0 /free Result = %DIFF(Date1 :Date2 :*D); // No. of Days difference between two Dates 36 Result = %DIFF(Date1 :Date2 :*M); // no. of month Difference between two Dates 1 Result = %DIFF(Time1 :Time2 :*H); // No. of Hour difference between two times 11 Result = %DIFF(Time1 :Time2 :*MN); // No. of minutes difference between two times 660 /end-free

71

%DIV dividend: divisor the quotient from the division of the two arguments

Syntax :- %DIV(N :M) Description :- This Built in function returns the integer portion of the quotient that result from dividing operands n by m Example :D Fld1 S 8p 0 inz(123) D Fld2 S 8p 0 inz(23) D Result S 15p 0 /free Result = %DIV(Fld1 :Fld2); // Result is now 5 /end-free Syntax :- %ELEM(Array Name) Description: - This Built in function returns number of elements in the specified array, table or multiple occurrence data structure. Example :D Arr1 S 5A dim(10) varying D Result S 2p 0 /free Arr1(1) = ‘Se’; Arr1(2) = ‘En’; Result = %ELEM(Arr1); // Result is now 10 /end-free Syntax :- %EOF(File Name) Description: - This built in function returns ‘1’, if the most recent read operation or write to subfile ended in an end of file or beginning of the file condition, otherwise it return ‘0’. Example :F Infile IF E K Disk /free Read Infile; Dow not %EOF(Infile);

%ELEM array, table, or multiple occurrence data structure name number of elements or occurrences

%EOF {file name} ’1’ if the most recent file input operation or write to a subfile (for a particular file, if specified) ended in an end-of-file or beginning-of-file condition ’0’ otherwise

72

Read Infile; Enddo; %FOUND {file name} ’1’ if relevant operation (for a file, if specified) found DELETE, SETGT, SETLL), an element match (CHECK, CHECKR, SCAN) ’0’ otherwise the most recent particular a record (CHAIN, (LOOKUP), or a Syntax :- %FOUND(File Name) Description: - This Built in function returns ‘1’, if the most recent relevant file operation found a record, a string operation found a match, or a Search operation found an element. Example :F CustFile IF E K Disk /free // Check if the customer is in the file Chain Cust CustFile If %FOUND(CustFile); Exsr Handle; Endif; /end-free Syntax :- %HOUR(number) Description: - This Built in function converts a number into a duration that can be added to a Time or Time Stamp value. Example :D Time1 S T inz(T’11.12.10’) D Time2 S T /free Time2 = Time1 + %HOURS(1); // Time2 is now 12.12.10 /end-free Syntax :- %LOOKUP(arg :array {:Starting Index {:number of elements }}) Description: - This Built in functions returns the array index of the item in array. Example :D Array1 ascend D Index /free

%HOURS number of hours number of hours as a duration

%LOOKUPxx argument: array{:start index {:number of elements}} array index of the matching element

S S

2A 2p 0

dim(5)

Array(1) = ‘A’; Array(2) = ‘C’;

73
Array(3) = ‘E’; Array(4) = ‘G’; Array(5) = ‘I’; Index = %LOOKUP(‘C’ :Array1); :Array1); :Array1); %MINUTES number of minutes number of minutes as a duration // Index is now 2 Index = %LOOKUPLT(‘F’ //Index is now 3 Index = %LOOKUPGT(‘H’ // Index is now 5 /end-free Syntax :- %MINUTES(number) Description: - This built in function converts a number into a duration that can be added to a time or time stamp value. Example :D Time1 S T inz(T’11.12.10’) D Time2 S T /free Time2 = Time1 + %MINUTES(10); // Time2 is now 11.22.10 /end-free Syntax :- %MONTHS(Number) Description: - This built in function converts a number into a duration that can be added to a date or time Stamp Example :D Date1 S D inz(D’2001-11-20’) D Result S D /free Result = Date1 + %MONTHS(2); // Result is now 200201-20 Result = Date1 %MONTHS(2); // Result is now 200109-20 /end-free %PARMS none number of parameters passed to procedure Syntax

%MONTHS number of months number of months as a duration

74

%PARMS Description %PARMS returns the number of parameters that were to the procedure in which %PARMS is used. Example C *ENTRY C 2 0 C C C

PLIST PARMS

COUNT %PARMS<1

IF ‘No Parms’ DSPLY ENDIF

In the above example since the received parameters count is one the message ‘No Prams' is not displayed. %REM dividend: divisor the remainder from the division of the two arguments Syntax %REM(n:m) Description %REM returns the remainder that results from dividing operand n by m. The two operands must be numeric values with zero decimal positions. Example D A S 10I 0 INZ(123) D B S 10I 0 INZ(27) D DIV S 10I 0 INZ D REM S 10I 0 INZ /free DIV = %DIV(A:B) // DIV is now 4 REM = %REM(A:B) // REM is now 15 /end-free In the above example the variable REM has a value 15 that is arrived using built-in-function %REM. %REPLACE replacement string: source string {:start position {:source length to replace}} string produced by inserting replacement string into source string, starting at start position Syntax %REPLACE(replacement string: source string {:start position {:source length to replace}})

75
and replacing the specified number of characters

Description %REPLACE returns the character string produced by inserting a replace string into the source, starting at the start position and replacing the specified number of characters. Example D VAR1 S INZ(‘Windsor’) D RESULT S

10I 0 10I 0 VARYING

VARYING /free result = var1 + ‘,’ + ‘ON’ // result = ‘Windsor, ON’ //%Replace with 2 parameters to replace text at beginning of string. Result = %replace(‘Toronto’; result); //result = ‘Toronto, ON) /end-free In the above example the variable RESULT is replace with ‘Toronto’ of first string var1. %SQRT numeric value square root of the numeric value Syntax %SQRT (numeric expression) Description %SQRT returns the square root of the specified numeric expression. Example D P /free

S

5P0

P = %SQRT (81); /end-free In the above example the variable P has value of 9 since square root of 81 is 9. %TIME {value {: time format}} the time that corresponds to the specified value,or the current system time if none is specified Syntax %TIME {(expression {:timeformat})} Description %TIME converts the value of the

76
expression from character, numeric, or timestamp data to type time. Example /free string = ’12:34 PM’; time = %time(string:*USA); // time variable has a value t’12.34.00 /end-free In the above example the function %TIME converts the string which is of character to a time field. %TRIM string string with left and right blanks trimmed Syntax %TRIM (string) Description %TRIM returns the given string less any leading and trailing blanks. Example D Location

S

16A Toronto,

/free Location = %trim(‘ Ontario ‘);

// Location will have value ‘Toronto,Ontario’ /end-free In the above example the function %TRIM trims the string ‘Toronto, Ontario’ and stores it in variable Location. %TRIML string string with left blanks trimmed Syntax %TRIML(string) Description %TRIML returns the given string less any leading blanks. Example

77
D Location S 16A Toronto,

/free Location = %triml(‘ Ontario ‘);

// Location will have value ‘Toronto,Ontario ’ /end-free In the above example the function %TRIML trims the string ‘Toronto, Ontario ’ and stores it in variable Location. %TRIMR string string with right blanks trimmed Syntax %TRIMR(string) Description %TRIMR returns the given string less any trailing blanks. Example D Location varying

S

16A

/free Location = %trimr(‘ Ontario ‘);

Toronto,

// Location will have value ‘ Toronto,Ontario’ /end-free In the above example the function %TRIMR trims the string ‘ Toronto, Ontario’ and stores it in variable Location. %XFOOT array expression sum of the elements Syntax %XFOOT(array-expression) Description %XFOOT results in the sum of all elements of the specified numeric array expression. Example D result S 15P5 /free result = %xfoot(ARR); // result will have the sum of all

78
elements of array ARR /end-free In the above example the function %XFOOT is used to sum of all elements of array ARR. %XLATE from-characters: to-characters: string {: start position} the string with from-characters replaced by to-characters Syntax %XLATE(from :to :string {:startpos}) Description %XLATE translates string according to the values of from, to, and startpos. The first parameter contains a list of characters that should be replaced, and the second parameter contains their replacements. Example D up C ‘ABCDEFGHIJKLMNOPQRSTUVWXYZ’ D lo C ‘abcdefghijklmnopqrstuvwxyz’ D String S 10A /free string = %XLATE(lo:up: ‘rpg dept’) // result will have the value ‘RPGT DEPT’ /end-free In the above example the function %XLATE translates the string from lower to upper case. %YEARS number of years number of years as a duration Syntax %YEARS(number) Description %YEARS converts a number into a duration that can be added to a date or time-stamp value. Example /free newdate = date + %YEARS(3)

79

/end-free In the above example the function %YEARS will add 3 years to date variable which is of type date.

What is the difference between subroutine & sub procedure A subprocedure is similar to a subroutine, except that a subprocedure offers the following improvements: You can pass parameters to a subprocedure, even passing by value. Parameters can be passed by reference also The parameters passed to a subprocedure and those received by it are checked at compile time for consistency. This helps to reduce run-time errors, which can be more costly. You can use a subprocedure like a built-in function in an expression. It allows to return a value to the caller. Names defined in a subprocedure are not visible outside the subprocedure. You can call the subprocedure from outside the module, if it is exported. You can call subprocedures recursively. The processing of a subroutine is much faster than a call to a subprocedure.

CL Program to find the number of lines of code for all the source that is available in the input library. *************** Beginning of data ************************************* /*-------------------------------------------------------------------*/ /* Author : S.Raja */ /* */ /* Company : Scandent */ /* */ /* Input : Library Name */ /* */ /* Output : Lines of code in each source. */ /* */ /* Compling Instructions : The object OUTSPF will not be available */ /* in the system. Execute the below command and complie the source */ /* interactively. */ /* */ /* DSPFD FILE(QGPL/QRPGSRC) TYPE(*BASATR) + */ /* OUTPUT(*OUTFILE) OUTFILE(QTEMP/OUTSPF) */ /* */ /*-------------------------------------------------------------------*/ PGM DCL DCLF /* /* PARM(&LIB) VAR(&LIB) TYPE(*CHAR) LEN(10) FILE(OUTSPF) */ */

Checks if the library in the input is a valid library. If not gives error message and program ends noramally. CHKOBJ OBJ(&LIB) OBJTYPE(*LIB)

80
MONMSG SNDPGMMSG GOTO ENDDO /* MSGID(CPF9801) EXEC(DO) MSG('Invalid Library name.') CMDLBL(END) */

Deletes work files if any in the QTEMP. DLTF FILE(QTEMP/OUTMBR) MONMSG MSGID(CPF0610 CPF2105) DLTF FILE(QTEMP/OUTSPF) MONMSG MSGID(CPF0610 CPF2105)

/* /*

Gets all file objects in the library. This is done to get all */ source physical files in the library and stores them in OUTSPF */ DSPFD FILE(&LIB/*ALL) TYPE(*BASATR) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/OUT1) CPYF FROMFILE(QTEMP/OUT1) TOFILE(QTEMP/OUTSPF) + CRTFILE(*YES) INCREL((*IF ATDTAT *EQ 'S')) */ */

/* Reads the source physical file and gets all the source /* available in the source PF and the inout library. READ: RCVF RCDFMT(QWHFDBAS) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) DSPFD FILE(&LIB/&ATFILE) TYPE(*MBRLIST) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/OUTMBR) + OUTMBR(*FIRST *ADD) CMDLBL(READ)

GOTO

/* Query reads the file OUTMBR and groups them according to the /* source type and the number of line of code. END: RUNQRY QRY(RTVMBRQ) MONMSG MSGID(CPA0701)

*/ */

ENDPGM ****************** End of data **************************************** Note : Code the above program without the query(RTVMBRQ). Compile the program and execute the program once. The outfile OUTMBR will be created in QTEMP. Then create the below query. Code this query in the above CL program. Complie and execute. Query defnition for RTVMBRQ. Specify File Selections Type choices, press Enter. file selection. File . . . Library Member . . Format . . . . . . . . . . . . . . . . . . . . . . . . . . Press F9 to specify an additional OUTMBR QTEMP *FIRST QWHFDML Name, Name, Name, Name, F4 for list *LIBL, F4 for list *FIRST, F4 for list *FIRST, F4 for list

81
Select and Sequence Fields Type sequence number (0-9999) for the names of up to 500 fields to appear in the report, press Enter. Seq Field Len Dec 10 MLNAME 10 20 MLSEU 4 30 MLNRCD 10 0 40 MLMTXT 50 50 MLFILE 10 60 MLLIB 10 MLRCEN 1 MLRDAT 6 MLRTIM 6 MLFTYP 1 MLFILA 4 MLMXD 3 Text Member Source type for S/38 View as it appeared o Current number of records Text 'description' File Library Retrieval century: 0=19xx, 1=20xx

Retrieval date: year/month/day Retrieval time: hour/minute/second P=PF, L=LF, R=DDM PF, S=DDM LF File attribute: *PHY or *LGL Reserved

Select Sort Fields Type sort priority (0-999) and A (Ascending) or D (Descending) for the names of up to 32 fields, press Enter. Sort Prty A/D Len Dec 10 A 4 10 10 50 10 10 0 Field MLSEU MLNAME MLNRCD MLMTXT MLFILE MLLIB Text Source type for S/38 View as it appeared Member Current number of records Text 'description' File Library

82

Select Report Summary Functions Type options, press Enter. 1=Total 2=Average 3=Minimum ---Options--Len Dec 5 10 4 1 10 50 10 10 0 Field MLNAME MLSEU MLNRCD MLMTXT MLFILE MLLIB Text Member Source type for S/38 View as it app Current number of records Text 'description' File Library 4=Maximum 5=Count

Define Report Breaks Type break level (1-6) for up to 9 field names, press Enter. (Use as many fields as needed for each break level.) Break Level Len Dec 10 4 10 50 10 10 1 0 10 Sort Prty Field MLNAME MLSEU MLNRCD MLMTXT MLFILE MLLIB Text Member Source type for S/38 View as it app Current number of records Text 'description' File Library

How to call CL program with parameters: CALL PGM(DATE_DIFF) PARM(X'030082004F' X'030082004F' X'00000F') SQL Example:

83

DSTMT s 200A C *entry plist c parm lib 10 c parm fil 10 c parm fld 10 c parm val 2 C* c Eval stmt = 'delete from '+%trim(lib)+'/' c + %trim(fil) + ' where ' c + %trim(fld) + ' = ' c + '?' C* C/Exec Sql C+ whenever sqlerror goto Errortrap C/End-Exec * C/Exec Sql C+ PREPARE S1 FROM :stmt C/End-Exec C* C/Exec Sql C+ EXECUTE S1 using :val C/End-Exec c Goto End c Errortrap Tag c 'Error' Dsply c sqlcod Dsply c sqlerrd(3) dsply c End Tag C Eval *INLR=*On IFS folder- Display Image from IFS folder... PGM DCL VAR(&STR1) TYPE(*CHAR) LEN(100) DCL VAR(&S1) TYPE(*CHAR) LEN(20) DCLF DSPFIL1 L1: SNDRCVF IF COND(&IN01='1') THEN(GOTO CMDLBL(L2)) ELSE CMD(DO) CHGVAR VAR(&STR1) VALUE('\\SCANMAC\DIR1\' *TCAT &VAR1 + *TCAT '.JPG') STRPCO MONMSG MSGID(CPF0000) STRPCCMD PCCMD(&STR1) PAUSE(*NO) GOTO L1 ENDDO L2: ENDPGM To Debug the Batch PGM's First step: compile all the modules with parameter DBGVIEW(*ALL)

84
To 1° 2° 3° 4° 5° 6° debug a batch program: The job has to be hold in the JOBQ. Take note of the job attributes (DSPJOB option 1) STRSRVJOB with the attributes of the work (these are noted at 2°) STRDBG of the program, then release the job F10, then DSPMODSRC for see the source to place a execution stop (F6) F12, F3, ENTER and F12 to go to the execution stop.

Is there a way to monitor abnormal terminations when compiling RPG or ILE RPG programs within a CL program? Yes, you can programmatically determine whether a compile was successful for both RPG and ILE RPG members. The compiler generates data area RETURNCODE in library QTEMP. This is a 400-byte character data area containing information about the compile. The short answer to your question is that the first byte of this data area will contain '1' for a successful compile or '0' for an unsuccessful compile. Your CL program containing the compile commands can retrieve the data area and check this value. Send Mail to Mail id Pgm SNDDST TYPE(*LMSG) TOINTNET(('johnsonhenry.kulandaisamy@scandent.com')) DSTD('Henry from AS/400 Dev Box') LONGMSG('Hai from henry , Now i am into the DEV Box.He he he....') IMPORTANCE(*HIGH) PTY(*HIGH)

Steps involved in implementing commitment control. Step1 First create the journal receiver:

CRTJRNRCV JRNRCV(MYJRNRCLIB/MYJRNRCV)

Step2 Next, create the journal specifying the journal receiver created above: CRTJRN JRN(MYLIB/MYJRN) JRNRCV(MYJRNRCLIB/MYJRNRCV) Step3 And, finally, start journaling on the physical file:

85

STRJRNPF FILE(*LIBL/CCTESTPF) JRN(MYLIB/MYJRN) PGM

Precautions to be taken while doing the above steps CRTJRNRCV

1. Be sure to: o Place the journal receiver in a library that is saved regularly. o Choose a journal receiver name that can be used to create a naming convention for future journal receivers, such as RCV0001. You can use the *GEN option to continue the naming convention when you change journal receivers. This type of naming convention is also useful if you choose to let the system manage the changing of your journal receivers CRTJRN

1. Be sure to: o Specify the name of the journal receiver that you created in the first step. o Use the Manage receiver (MNGRCV) parameter to have the system change the journal receiver and attach a new one when the attached receiver becomes too large. If you choose this option, you do not need to use the CRTJRN command to detach receivers and create and attach new receivers manually. o Specify DLTRCV(*NO) only if you have overriding reasons to do so (for example, if you need to save these journal receivers for recovery reasons). If you specify DLTRCV(*YES), these receivers might be deleted before you have a chance to save them. You can use two values on the RCVSIZOPT parameter of the CRTJRN command (*RMVINTENT and *MINFIXLEN) to optimize your storage availability and system performance. See the AS/400 Programming: Performance Tools Guide for more information. STRJRNPF 1. Start journaling the source table using the Start Journal Physical File (STRJRNPF) command, as in the following example: 2. STRJRNPF FILE(library/file) 3. JRN(JRNLIB/DJRN1) 4. OMTJRNE(*OPNCLO) 5. IMAGES(*BOTH) 6.

86
Specify the name of the journal that you created in step 2. The Capture program requires a value of *BOTH for the IMAGES parameter. The data integrity can be maintained using commitment control

Step4 (Last step) - (Starting commitment control)

STRCMTCTL LCKLVL(*CHG) CALL PGM(*LIBL/CCTEST2) COMMIT CALL PGM(*LIBL/CCTEST2) ROLLBACK ENDCMTCTL RETURN ENDPGM Points of concern while implementing commitment control in Bastion 1. If any ILE or RPG program is performing any file operation such as Update, add or delete, then Fspec has to be continued for the particular file to incorporate KCOMIT. 2. Study has to be done if to COMIT the changes individually after every file operation or collectively after processing all records. 3. Study has to be done if to call the program STRCMTCTL as an IPL or invoke the program that implements commitment control before a particular maintenance program is called. 4. A decision has to be made if to journal the files in all environments or to journal only the files in development box. If we journal the files only in development box, then the changed programs may not produce consistent results during testing. 5. If a decision has been made to journal all the files then space might be a constaint 6. Till the completion of bastion code consolidation , JHL environment and BASTION objects must be attached to to different journals.

Brief notes on commitment control Commitment control lets you define and process a number of changes to database files in a single unit (transaction). Commitment control can ensure that complex application transactions are logically synchronized, even if the job or system ends. Two-phase commitment control ensures that committable resources, such as database files on multiple systems, remain synchronized. Transactions

87
A transaction is a group of changes that appear as a single change, such as the transfer of funds from a savings account to a checking account. Transactions can be classified as follows: • • • • Inquiries in which no file changes occur. Simple transactions in which one file is changed each time you press the Enter key. Complex transactions in which two or more files are changed each time you press the Enter key. Complex transactions in which one or more files are changed each time you press the Enter key. These changes represent only part of a logical group of transactions.

Revisions made to files during transaction processing are journalled when using commitment control. If the system or job ends abnormally, journaling alone can ensure that, at most, only the very last record change is lost. However, if the system or job ends abnormally during a complex transaction, the files reflect an incomplete logical transaction. For example, the job may have updated a record in file A, but before it updated a corresponding record in file B, the job ended abnormally. In this case, the logical transaction consisted of two updates, but only one update completed before the job ended abnormally. Benefits of using commitment control Recovering a complex application requires detailed application knowledge. Programs cannot be restarted. For example, record changes may have to be made with an application program or data file utility to reverse the files to just before the last complex transaction began. This task becomes more complex if multiple users were accessing the files at the same time. Commitment control helps solve these problems. Commitment control locks records from other users during a complex transaction. This ensures that other users do not use the records until the transaction is complete. At the end of the transaction, the program issues the commit operation, freeing the records. However, should the system end abnormally before performing the commit operation, all record changes for that job since the last time a commit operation occurred are rolled back. Any affected records that are still locked are then unlocked. In other words, database changes roll back to a clean transaction boundary. Map Field –OPNQRYF CHGVAR VAR(&QRYSLT) VALUE('ENTRYDATE *EQ %RANGE("' + *CAT &STARTDATE *CAT '" "' *CAT &ENDDATE + *CAT '") *and smbchp *eq "ALP" *and + smtrcd *le "17"') OPNQRYF FILE((ALSTMF15)) QRYSLT(&QRYSLT) + KEYFLD((SMCONR) (SMPRFX) (SMPLNR) + (SMTECN) (SMTEYY) (SMTEMM) (SMTEDD) + (SMEFCN) (SMEFMM) (SMEFMM) (SMEFDD) + (SMREFN)) MAPFLD((ENTRYDATE +

88
'%digits(smetcn) *cat %digits(smetyy) + *cat %digits(smetmm) *cat + %digits(smetdd)' *CHAR 8))