Manual Rpg Free As400

  1. Manuals Rpg Free As400
  2. Iseries Rpg Free

This is a comprehensive listing of all the as400 manuals that are available as PDFS in the IBM Infocenter. AS/400 Programming with VisualAge for RPG AS/400 Remote Journal Function for High Availability and Data Replication. Free (16) free as400 software (30) free format (1) frog (1) funny (1) groovy (1) HA (1) halcyon (1) hibernate (2). Hola a todos. Desearia se me facilite algun manual de RPG FREE, me parece muy interesante y desearia ahondar en eso. ILE RPG Programmer’s Guide This guide provides information that shows how to use the ILE RPG compiler (ILERPG) in the Integrated Language Environment. ILE RPG is an implementation ofthe RPG IV language on the iSeries server with the Operating System/400(OS/400) operating system. ILE RPG, RPG IV Specifications (H, F, D, I, C, O and P) - AS/400 ISeries on Simple RPGLE Program (Hello World) CL Procedures / CL commands - AS400 ISeiries IBM on AS400 Control Language Using the Source Entry Utility SEU - AS400 ISeries IBM on Program Development Manager (PDM). This is ideal for the versions of RPG that were available in IBM i 6.1, but not for totally free RPG, which was released in IBM i 7.2 TR3 and 7.1 TR11. When using totally free RPG you can use every column in the member, from the first to the end, whatever column that maybe. Rpgle reference manual pdf ISeries 5722-WDS, ILE RPG compiler, and to all subsequent releases and modifications until otherwise. Changes to this Reference Since V5R1. Iseries rpgle reference manual Xv.Use this guide to create and run ILE applications from RPG IV source. ILE RPG Reference Link to PDF HTML version. This book provides. The AS/400 & IBM i RPG & RPGIV Programming Guide Source: The AS/400 & IBM i RPG & RPGIV Programming Guide – PDF Free Download – Fox eBook Category: Books, Manuals, IBMi / AS400 Education.

Fixed FormatFree Format

Manuals Rpg Free As400

EVAL

Note:Some free format examples only work with V5R1 and higher.

Note:In free format the EVAL operation is not required sometimes.

Multiple Examples follow:

/FREE

EVALTotal = A * (B – 1)Total = A * (B – 1);

EVALTotal = Total +1Total = Total + 1;

Total += 1;//Short for previous example

EVALTotal = Total – CountTotal = Total – Count;

Total -= Count; //Short for previous example

EVALTotal = Total * CountTotal = Total * Count;

Total *= Count;//Short for previous example

EVALTotal = Total / 7Total = Total / 7;

Total /= 7;//Short for previous example

Total = Total ** 2;//Exponentiation

Total **= 2;//Exponentiation

//Short for previous example

EVAL(H)Interest = Rate * AmtEVAL(H) Interest = Rate * Amt; //EVALused for half adjust

EVALA = %TRIMR(‘Hi ‘) +A = %TRIMR(‘Hi ‘) + %TRIML(Chars);

%TRIML(Chars)

***After the EVAL below, the value of Chars contains ‘ab****ghijklmno’

EVAL%SUBST(Chars:3:4) = ‘****’%SUBST(Chars:3:4) = ’****’;

/END-FREE

EVALR

Note:The expression is evaluation and the result is placed right-adjusted in the result field.

/FREE

EVALRName = ‘Jimmie‘EVALR Name = ‘Jimmie‘;

//Name =‘Jimmie‘//Name = ‘Jimmie‘

EVALRName = %TRIMR(‘Jimmie‘)EVALR Name = %TRIMR(‘Jimmie‘;

//Name = ‘Jimmie’//Name = ‘Jimmie’

/END-FREE

Fixed FormatFree Format

ELSEIF

Note:Instead of Nesting Ifs use an ELSEIF or a SELECT/ENDSL below.

In the last stage of the ELSEIF, the ‘ELSE’ part is optional.

/FREE

IFAge >= 20 and Sex = ‘F’IF Age >= 20 and Sex = ‘F’;

EVALCode = 5Code = 5;

ELSEIFAge >= 20 and Sex = ‘M’ELSEIF Age >= 20 and Sex = ‘M’;

EVALCode = 4Code = 4;

ELSEIFAge >= 30 and Sex = ‘F’ELSEIF Age >= 30 and Sex = ‘F’;

EVALCode = 10Code = 10;

ELSEIFAge >= 30 and Sex = ‘M’ELSEIF Age >= 30 and Sex = ‘M’;

EVALCode = 9Code = 9;

ELSEELSE

EVALCode = 20Code = 20;

ENDIFENDIF;

/END-FREE

SELECT/ENDSL

Note:Instead of Nesting Ifs use a SELECT/ENDSL or an ELSEIF above.

In the last stage of the SELECT, the ‘OTHER’ part is optional.

/FREE

SELECTSELECT;

WHENAge >= 20 and Sex = ‘F’WHEN Age >= 20 and Sex = ‘F’;

EVALCode = 5Code = 5;

WHENAge >= 20 and Sex = ‘M’WHEN Age >= 20 and Sex = ‘M’;

EVALCode = 4Code = 4;

WHENAge >= 30 and Sex = ‘F’WHEN Age >= 30 and Sex = ‘F’;

EVALCode = 10Code = 10;

WHENAge >= 20 and Sex = ‘M’WHEN Age >= 30 and Sex = ‘M’;

EVALCode = 9Code = 9;

OTHEROTHER;

EVALCode = 20Code = 20;

ENDSLENDSL;

/END-FREE

Fixed FormatFree Format

FOR

Note:Controls the number of times a group of operations are processed.

/FREE

EVALFactor = 1Factor = 1;

FORI =1 to %LEN(Field)FOR I = 1 to %LEN(Field);

EVALFactor = Factor + 1Factor = Factor + 1;

ENDFORENDFOR;

/END-FREE

%CHAR

Note:Converts the value of the expression from graphic, UCS-2, numeric, date, time,

or timestamp data to type character.

/FREE

EVALResult= ‘It is ‘ + %CHAR(Time)Result = ‘It is ‘ +%CHAR(Time)

+ ‘ on ‘ + %CHAR(Date)+ ‘ on ‘ + %CHAR(Date);

*** Result = ‘It is 12:23:34 on 02/02/1977’

/END-FREE

%EDITC

Note:Returns a character result representing the edited number after applying and edit code.

/FREE

EVALSal =‘The annual salary is ‘Sal = ‘The annual salary is ‘

+ TRIM(%EDITC(Amt * 12+ TRIM(%EDITC(Amt * 12

:’A’ : *CURSYM)):’A’: *CURSYM));

*** Sal = ‘The annual salary is $12,000.00’

/END-FREE

ADDDUR

Note:The ADDDUR operation adds the duration specified in factor 2 to a date or time and places the resulting Date, Time or Timestamp in the result field.

/FREE

BillDateADDDUR30:*DAYSDueDateDueDate = BillDate + %DAYS(30);

/END-FREE

SUBDUR

Note:Subtract a duration to establish a new Date, Time or Timestamp.

/FREE

DueDateSUBDUR30:*DAYS BillDateBillDate = DueDate - %DAYS(30);

/END-FREE

Fixed FormatFree Format

EXTRCT

Note:Extracts a portion of a date, time, or timestamp data item.

Iseries Rpg Free

/FREE

EXTRCTBirthDate:*YBirthYearBirthYear = %SUBDT(BirthDate:*YEARS);

/END-FREE

%DEC / %DECH / %UNS / %UNSH / %INT / %INTH / %FLOAT

Note:As of V5R2 you can convert character arguments to numeric with all of these functions.

Note:These functions can now be used to support “LEGACY” code.

Note:The sign (+ or -), decimal point (. or ,),are optional.

Note:Invalid numeric data will set %STATUS = 00105.

/FREE

EVALChars = ‘-123.56’Chars = ‘-123.56’;

EVALNum = %DEC(Chars:5:2)Num = %DEC(Chars:5:2);//Num = -123.56

EVALNum = %UNSH(Chars)Num = %UNSH(Chars);//Num = 124

/END-FREE

***D Spec:

D ToDateS80INZ(20021231)

D WorkDateSD

Fixed Format

EVALToDate = 20021231

EVALWorkDate = %DATE(ToDate:*ISO) //WorkDate = D’2002-12-31’

EVALWorkDate = WorkDate + %DAYS(30)//Add 30 days to WorkDate

EVALToDate = %UNS(%CHAR(WorkDate:*ISO))//ToDate = 20030130

Free Format

/FREE

ToDate = 20021231;

WorkDate = %DATE(ToDate:*ISO);//WorkDate = D’2002-12-31’

WorkDate = WorkDate + %DAYS(30);//Add 30 days to WorkDate

ToDate = %UNS(%CHAR(WorkDate:*ISO));//ToDate = 20030130

/END-FREE


Fixed FormatFree Format

%TIME / %TIMESTAMP

Note:Converts the value of the expression from character, numeric, or |timestamp data to type time. The converted value remains unchanged, but |is returned as a time.

Note:Available as of V5R2.

/FREE

EVALString = ’12:34 PM’String = ’12:34 PM’;

EVALTime = %TIME(String,*USA)Time = %TIME(String:*USA);

//Time = t’12.34.00’

/END-FREE


Fixed FormatFree Format

%DIFF

Note:Used to find the duration between:two dates, two times, two timestamps, a date and the date

portion of a timestamp, and a time and the time portion of a timestamp.

/FREE

EVALDaysLeft = %DIFF(ExamDate:DaysLeft = %DIFF(ExamDate:Today:*DAYS);

Today:*DAYS)/END-FREE

MONITOR/ENDMON

Note:May be used with V5R1 and later.

Note:Used for error handling routines.ON-ERROR list one or more errors for which it is responsible.

These errors generally correspond to the %STATUS code from 00100 to 09999 or you can use *FILE

for file errors.

/FREE

MONITORMONITOR;

READRickfileREAD Rickfile;

DOWNOT %EOF(Rickfile)DOW NOT %EOF(Rickfile);

KEYCHAINRickfile2CHAIN KEY Rickfile2;

EXSRDoSomethingEXSR DoSomething;

READRickfileREAD Rickfile;

ENDDOENDDO;

ON-ERROR1211ON-ERROR 1211;

EXSRNotOpenEXSR NotOpen;

ON-ERROR1218ON-ERROR 1218;

EXSRLockedRecEXSR LockedRec;

ON-ERROR*FILEON-ERROR *FILE;

EXSRFileErrEXSR FileErr;

ON-ERROR00100 : 00121ON-ERROR 00100 : 00121;

***Handle string error and array-index error***********************

EXSRSTRARYEXSR STRARY;

ON-ERRORON-ERROR;

***Handle all other errors**************************************

EXSRGenErrEXSR GenErr;

ENDMONENDMON;

/END-FREE


Fixed FormatFree Format

LEAVESR

Note:Used with free format only.Leaves a subroutine.

/FREE

LEAVESR;

/END-FREE

MOVE AND MOVEL

Note:RPGIV and free format provides a smoother process.

OLD RPGIII:

MOVELFIELD1FIELDA

MOVEFIELD2FIELDA

MOVELFIELDAFIELDB

MOVEFIELD3FIELDB

NEW RPGIV and free format:

/FREE

EVALFieldB = Field1 + Field2 + Field3FieldB = Field1 + Field2 + Field3;

/END-FREE

INDICATOR DATA TYPE

Note: Some free format examples only work with V5R1 and higher.

Note:Some languages refer to this as a Boolean data type.An indicator field is a single-byte field

that can contain only two logical values: ‘1’ or ‘0’.You can also refer to these values using *ON

and *OFF, respectfully.Indicator data is usually used within an RPGIV program to signal a true/false

condition and can be tested on as a true/false condition.

Examples follow:

D Spec:

DIsGoodSNINZ(*OFF)

/FREE

Rpg free format

EXSRChkGoodEXSR ChkGood;

IFIsGoodIF IsGood;

EXSRDoSomethingEXSR DoSomthing;

EVALIsGood = *OFFIsGood = *OFF;

ELSEELSE;

EXSRGiveErrEXSR GiveErr;

ENDIFENDIF;

/END-FREE