Rpg Programming Tutorial

Rpg Programming Tutorial
Contents .ix.ixPrerequisite.ixYourWhat's New

....

xi.xi.xv.xx.xxii .xxvii .xxxi .xxxv .xxxix Part 1.ILE RPG Introduction .

...Chapter 1.Overview of the RPG IV Programming Language .

.

...

..RPG IV Specifications ..

..

.

ProgrammingSubprocedureIndicators ...

.



Operation Codes ....

.



.. .

3.Program Creation Strategies 23 .IBM Corp.

1994, 2006 8.Creating a Service Program 91 .103 Program .103 ProgramFrom.105 ProgramUser-Created.108 Run-Time.108 Program.109 Your.121 .129 Program/Procedure.129 Programs.130 Procedures.130 .131 .131 Parameter-Passing.133 Prototyped.134 .135 Expression.135 Free-Form.136 Prototyped.136 .136 .139 .140 Checking for the Number of Passed Parameters 142 Required.147 Order.148 .148 .149 .150 .151 PARM.151 fromProgramProcedure.153 fromProcedure.153 fromSubprocedure.155 .156 .156 .157 .158 .158 Multithreading.158 ShareAcrossMore.159 Avoid.160 11.World.163 .163 Processing.163 .169 .169 Introduction.169 from.173 .179 ControllingVirtual.180 .181 Errorsfrom.184 .186 .197 .198 programsfrom .205 .207 Source.208 .208 PreparingProgram.210 CreatingView.213 CreatingView.213 Source.214 .215 .216 Programsfrom.216 Program.217

Programmers | | # # # # #Appendix C.The Create Commands 455 .455 Interpret.455 CRTBNDRPG.456 CRTBNDRPG.459 CRTRPGMOD.473 CRTRPGMOD.475 .477 .478 Prologue.478 Source.480 .485 Buffer.486 Table.486 Compile-Time.486 .487 Cross-ReferenceTable.488 EVAL-CORR.489 References.490 .491 .491 Errors.492 .493 Programming.494 Trademarks.494 .497 .499 Contents vii | | IBM Corp.

1994, 2006 (xmldocument { : options } )controlexpression,%HANDLER (handlingProcedure : communicationArea ){ (e) } %HANDLER(eventHandler : commArea ) %XML(xmldocument { : saxOptions } );{ (EH) } variable %XML(xmlDoc { : options }); XML-INTO{ (EH) } %HANDLER(handler : commArea ) %XML(xmlDoc { : options }); Whats New .=== EVAL _QRNU_NULL_DS

EVAL = 1

_QRNU_NULL_DS1.FLD2 = 0

_QRNU_NULL_DS1.SUB.FLD3 = 1 === EVAL = 0 === EVAL _QRNU_NULL_DS.FLD2 = 1 === EVAL = abcde

=== EVAL = New : start : num) specifies array elements array(start) to array(start + num - 1) Example:

// Copy part of an array to another array:

resultArr = %subarr(array1:start:num);

// Copy part of an array to part of another array:

%subarr(Array1:x:y) = %subarr(Array2:m:n);

// Sort part of an array

sorta %subarr(Array3:x:y);
// Sum part of an array

sum = % D numDdMmYy s 6p 0

D date

s d datfmt(*jul)

date = D2003-08-21;

numDdMmYy = %dec(date : *dmy);

// now numDdMmYy = trimchars = *-.;

data = ***a-b-c-.

result = %trim(data : trimchars);

// now result = a-b-c.

All * - and .were trimmed from the ends of the proc pr D parm1 5a const options(*trim) D parm2 5a const options(*trim : *rightadj) D parm3 5a const varying options(*trim)Whats New - - -Dos400.stderr=file:stderr.txt; New : = = Spot; : D custkeyDS e ds (keyA : keyB : key3) custrec;

CHAIN %KDS(custkeyDS) custrec; New : totals(current_customer) += count; ).Table Language Unit Element Description Built-in functions %DEC(expression) character.

%DECH(expression) %FLOAT(expression) %INT(expression) %INTH(expression) %UNS(expression) %UNSH(expression) keywords DTAARA({*VAR:}data-area-name) areaLIBRARY/NAMEarearuntime.DIM structure LIKEDS Allowed for subfield specifications.EXTNAME(filename{:extrecname} ) controlsstructure.

Definition Specifications Length and decimal place entries The length and number of decimal places can be 31 for packed and zoned fields.

Operation codes SETGT, free-form READP,UPDATE, recordstructureresult UPDATE free-formargument FEOD buffers Calculation specifications Length and decimal place entries The length and number of decimal places can be 31 for packed and zoned fields.Whats New About This Guide xxiTable Language Unit Element Description Expressions Assignment Operators += -= *= /= **= aretarget ControlKeywords DECPREC(30|31) Controlsprecisionpresentation, keywords LIKEREC(intrecname{:*ALL| structurearerecord Built-in functions %BITAND(expressionexpression) resultarecorrespondingare %BITNOT(expression) resultareargument.

%BITOR(expressionexpression) resultarecorresponding %BITXOR(expressionexpression) resultarecorresponding %FIELDS(name{:name...}) free-formUPDATE structure) free-formSETGT,arestructure. New ProgrammersTable Language Unit Element Description Operation codes MONITOR grouperror ON-ERROR error ENDMON grouperror ELSEIF Equivalent to an ELSE operation code followed by an IF operation code.

CRTBNDRPGCRTRPGMODkeywords LICOPT(options) Specifies Licensed Internal Code New About This Guide xxviiTable Language Unit Element Description Operation codes EVALR result=expression.result FOR .

ENDFOR group LEAVESR New About This Guide xxxiTable Language Unit New Description %FOUND{file name} recentrelevantrecordSETGT,returns %OPEN(file name) Returns 1 if the specified file is open and 0 if the specified file is closed.%}}) producedreplacing %STATUS{file Operation code Extender E error%STATUSerror New century formats *CMDY (cmm/dd/yy) be used by the MOVE, MOVEL, and TEST operations.*CDMY (cdd/mm/yy) be used by the MOVE, MOVEL, and TEST operations.

New 4-digit year format *LONGJUL (yyyy/ddd) be used by the MOVE, MOVEL, and TEST operations.Command parameters PRFDTA PRFDTAprofiling BNDDIR previouslyCRTBNDRPGCRTRPGMOD New About This Guide .Table Language Unit Element Description keywords ALIGN previously OPTIONS(*NOPASS*VARSIZE The *STRING option allows you to pass a character value as a null-terminated string
rpg programming tutorial
Rpg Web Programming - Scott Klement's Web Page
• It’s easy to get started with Web programming in RPG. If you find that you need more, go right ahead and upgrade. In that case, this’ll just be (scottklement.com)
Ile Rpg Programmer's Guide - Ibm - United States
RPG programming language, but who want to learn how to use it in the ILE framework. This guide is also for programmers who want to convert programs from the RPG III to the RPG … (scottklement.com)
Asna Visual Rpg
RPG programming teams. Where most products drive a wedge between the two camps, AVR for .NET brings the two teams together to work cohesively on your IT solutions. (scottklement.com)
.Recordaddress F (Float format) recordaddressprocessingprogram Internal data type F (Float format) parameter,structure Data format F (Float format) program Whats New About This Guide xxxviiTable Language Unit New Description Controlkeywords COPYNEST(1-2048) directives.EXPROPTS(*MAXDIGITS | *RESDECPOS) Expressionprecisionprecisionrules) FLTDIV{(*NO expressionsare keywords ALTSEQ(*NONE) Forces Built-in functions %ABS expressionparameter.%DEC & %DECH expression %DECPOS expression.returnedwhere %EDITC %EDITFLT expressionrepresentation %EDITW .%FLOAT expression %INT & %INTH %LEN expression.%NULLIND Used to query or set the null indicator for null-capable fields.%SCAN searchargumentsource Whats New ProgrammersTable Language Unit New Description %STR createare %UNS & %UNSH expressionaretruncatedrounded Operation code Extenders N Sets pointer to *NULL after successful DEALLOC M precisionrules R resultprecisionrules) Operation codes ALLOC dynamically.

DEALLOC dynamically.REALLOC reallocatedynamically. New About This Guide .Table Language Unit Element Description keywords PREFIX(prefix_stringreplaced}) prefixingrename keywords CONST{(constant)} prototypedreference PREFIX(prefix_stringreplaced}) prefixingrename Operation codes RETURN controlcaller,returns Whats New ProgrammersTable Language Unit New Description Controlkeywords COPYRIGHT(copyright string) programs EXTBININT{(*NO | *YES)} programprocessing NOMAIN subprocedures keywords BLOCK(*YES |*NO) controlrecordare keywords ALIGN Specifies whether integer or unsigned fields should be aligned EXTPGM(name) prototypedprogram EXTPROC(name) prototypedprocedure OPDESC areprototyped OPTIONS(*NOPASS*VARSIZE) prototyped STATIC Specifies that the local variable is to use static storage VALUE prototyped Built-in functions %PARMS Returns the number of parameters passed on a call Operation codes CALLP prototypedprogramprocedure Specification type Procedure subprocedure Definition type PR prototype PI procedure blank in positions 24-25 prototyped Whats New About This Guide IBM Corp.1994, 2006 IV Overview >*..1 ...+...

2 ...+...3 ...+...4 ...+...

5 ...+...6 ...+...

7 ..* ++++++++++++++++++++* A R EMP_REC A EMP_NUMBER 5 TEXT(EMPLOYEE NUMBER) A EMP_NAME 16 TEXT(EXPLOYEE NAME) A EMP_RATE 5 2 TEXT(EXPLOYEE RATE) A K EMP_NUMBER Figure 2.

DDS for Employee physical >*..1 ...+...2 ...+...3 ...+...4 ...+...5 ...+...6 ...+...7 ..* ++++++++++++++++++++* A R TRN_REC A TRN_NUMBER 5 TEXT(EMPLOYEE NUMBER) A TRN_HOURS 4 1 TEXT(HOURS WORKED) A TRN_BONUS 6 2 TEXT(BONUS) Figure 3.DDS for TRANSACT physical file*..1 ...+...2 ...+...

3 ...+...4 ...+...5 ...+...6 ...+...

7 ...+...8 HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ H DATEDIT(*DMY/) Example of an ILE RPG Program ,*..1 ...+...2 ...+...

3 ...+...4 ...+...

5 ...+...6 ...+...

7 ...+...+.. OQSYSPRT

H 1P 2 3 O 35 PAYROLL REGISTER O *DATE Y 60 O H 1P 2 O 60 Heading1 O H 1P 2 O 60 Heading2 O D N1PN99 2 O TRN_NUMBER 5 O EMP_NAME 24 O EMP_RATE L 33 O TRN_HOURS L 40 O TRN_BONUS L 49 O Pay 60 $ 0.

O D N1P 99 2 O TRN_NUMBER 5 O 35 ** NOT ON EMPLOYEE FILE ** O T LR O 33 END OF LISTING Example of an ILE RPG Program >* Constant Declarations

*

*------------------------------------------------------------------------* D Heading1

C NUMBER NAME RATE H- D OURS BONUS PAY

D Heading2 C ______ ________________ ______ _- D ____ _______ >* Prototype Definition for subprocedure CalcPay

*

*------------------------------------------------------------------------* D CalcPay

PR 8P 2 D Rate 5P 2 VALUE D Hours 10U 0 VALUE D Bonus 5P 2 >* For each record in the transaction file (TRANSACT), if the employee

*

* is found, compute the employees pay and print the trn_number emp_rec;

if %found(emp_rec);

pay = CalcPay (emp_rate: trn_hours: >* Report Layout

*

*

-- print the heading lines if 1P is on *

*

-- if the record is found (indicator 99 is off) print the payroll *

*

details otherwise print an exception record *

*

-- print END OF LISTING when LR is on *

*------------------------------------------------------------------------* OQSYSPRT

H 1P 2 3 O 35 PAYROLL REGISTER O *DATE Y 60 O H 1P 2 O 60 Heading1 O H 1P 2 O 60 Heading2 O D N1PN99 2 O TRN_NUMBER 5 O EMP_NAME 24 O EMP_RATE L 33 O TRN_HOURS L 40 O TRN_BONUS L 49 O Pay 60 $ 0.

O D N1P 99 2 O TRN_NUMBER 5 O 35 ** NOT ON EMPLOYEE FILE ** O T LR O 33 END OF LISTING Figure 4.A Sample Payroll Calculation Program (Part 2 of 3)Example of an ILE RPG Program *------------------------------------------------------------------------*

* Subprocedure

-- calculates overtime pay.

*

*------------------------------------------------------------------------* P CalcPay

B D CalcPay PI 8P 2 D Rate 5P 2 VALUE D Hours 10U 0 VALUE D Bonus 5P 2 VALUE D Overtime S 5P 2 INZ(0)

/free

// Determine any overtime hours to be paid.

if Hours

40;

Overtime = (Hours - 40) * Rate * 1.5;

Hours = 40;

endif;

// Calculate the total pay and return it to the caller.

return Rate * Hours + Bonus + Overtime;

/end-free P CalcPay

E Figure 4.A Sample Payroll Calculation Program (Part 3 of 3)Using the i5/OS System .Table Integrated Language Environment (ILE) Original Program Model (OPM) Extended Program Model (EPM) C++ BASIC (PRPQ) FORTRAN C CL PASCAL CL COBOL COBOL PL/I (PRPQ) RPG RPG IBM Corp.1994, 2006 described filesCopy source HLL ProcessTwo-StepProcessILE Program(CRTPGM)

Figure 5.Program Creation in ILERPG Programming in ILE Programming in ILE Programming in ILE Activation GroupSupplied Service*SRVPGM(Z)CRTBNDRPGILE Program Using CRTBNDRPG .
Web programming with rpg
.
by Windbell is an mixed with a programming game. via wereintrigued wanttotry
J'aime une vido "RPG Creator : Create your MMORPG without programming knowledge" l'adresse
JFORCE is well rounded in the RPG programming. I would love to talk with you about these 3 positions and how JFORCE can help
Programming meets an RPG? It's more addictive than you think in Dungeon Diary for Android!
Tags: as/400 software tutorial,learning rpg programming,rpg programming training,rpg programming language,how to program an rpg,
© 2013 xkgfs            Privacy Policy - Contact