blog:iseries:rpg

This is an old revision of the document!


rpg_free

Misc tips/reminders

  • Concatenate with +
  • free-form supports +=
  • RTVQMQRY
  • RTVQMFORM
  • Check system files in QSYS2 lib
    • SYSCST (constraints)
    • SYSINDEXES
    • SYSKEYS (key fields for indexes)
    • SYSTABLES
    • SYSTYPES (UDTs)

ILE

  • compile modules with CrtRpgMod
  • use CrtPgm to bind modules into a callable program
  • can use CrtBndRPG to do both steps (creates a temp *Module object), but it may limit the ILE features
  • UPDPGM can update (re-attach) a module to the main object
  • CVTRPGSRC converts RPGIII code to RPGIV



There are three types of arrays:

  • The _run-time array_ is loaded by your program while it is running.
  • The _compile-time array_ is loaded when your program is created. The initial data becomes a permanent part of your program.
  • The _prerun-time array_ is loaded from an array file when your program begins running, before any input, calculation, or output operations are processed.

This will Z-ADD 15 to every element of ARRAY

C                 Z-ADD15 ARRAY

Each element of ARRAY1 will be added to the corresponding element of ARRAY2

C                    ADD ARRAY1 ARRAY2

%Abs

absolute value

%Char

converts to character
%CHAR(date : *iso)

%Check(look_for: string_to_search)

first position in string_to_search that is not a value in look_for

%Date(optional_date: optional_date_format)

if no date supplied, then get current date

%Days

number of days as a duration

%Dec

convert to packed number

%Dech

convert to packed number (half-adjusted)

%DecPos

# of decimal digits

%Diff

diff between 2 dates/times

%Div

divide 2 numbers
DIV = %DIV(A:B);   (divide A by B)

%Editc(Number: 'X': *CURSYM)

edit code (numeric)
  • Common codes (the X, above, or used in O specs)
  • 1-4 have no negative sign
  • 5-9 are user-defined @ system level
  • A-D use CR for negative values
  • J is most common (commas, dec separator, - for neg, shows zeros)
  • K (commas, dec separator, - for neg, zeros suppressed)
  • Y - for dates

|Edit Code Description|No Sign|CR Sign|-Sign (R)|-Sign (L)|

Commas and zero balances1AJN
Commas2BKO
Zero balances3CLP
No commas or zero balances4DMQ
User-defined edit codes5-9
Date edit (4 digits)W
Date editY
Suppress leading zerosZ

%Editw

edit word
  • blog/iseries/rpg.1583583628.txt.gz
  • Last modified: 2020/03/07 04:20
  • by tom