.st0{fill:#FFFFFF;}

RPG Evolution, Modernization and Refactoring – Step 2 of 4 – RPG Three becomes Four 

 September 11, 2009

By  NickLitten

MODERNIZE RPG SOURCE CODE – IBM Command to upgrade RPG3 to RPG4

First step is upgrde the old RPG3 (old style 80 character RPG) to the newer RPGLE format (112 character style). IBM gives us a command to do this and after running UPGRPGSRC (Upgrade RPG Source) on the old source a new member is created in QRPGLESRC:

* program to fix SLP06 records
 H DEBUG
 FEFP01L01 IF E K DISK INFSR(*PSSR)
 FACSUMMAR UF E K DISK INFSR(*PSSR)
 D LDA E DS EXTNAME(LDA)
 D PSTAT ESDS EXTNAME(PSDS)
 C *DTAARA DEFINE *LDA LDA
 C         IN     LDA
 C K01     KLIST
 C         KFLD   CUSN06
 C L#CONO  SETLL  ACSUMMAR
 C L#CONO  READE  ACSUMMAR 06
 C         DOW    *IN06 = *OFF
 C K01     CHAIN  EFP01L01 02
 C         IF     *IN02 = *OFF
 C         EVAL   BODV06 = AMOUNT
 C         ELSE
 C         EVAL   BODV06 = 0
 C         ENDIF
 C         UPDATE SLR06
 C L#CONO  READE  ACSUMMAR 06
 C         ENDDO
 C         EVAL  *INLR = *ON
 C         OUT    LDA
 * standard error handling routine.
 /Copy qgpl/qrpglesrc,pssr

As you can see the code if more or less the same, with the exception of few elements to make it more readable.

It’s still using indicators, but if/do loops are now completed with relevant ENDIF/DO and EVAL statement have apeared.

Note – make sure any /COPY entries are also upgraded – otherwise trying to suck in RPG3 code from copybooks will upset the compiler

So far it’s all been automatic, the CVTRPGSRC command is a wonderful thing.

Next step is to tidy up the code further so it morphs from a hybrid RPG3-4 to full blooded RPG4

  1. Take the code and upgrade it to RPG/4
  2. Tidy the Code
  3. Do some Refactoring and make it smile
  4. Evolve to RPG4 and make it awesome

NickLitten


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"cff50":{"name":"Main Accent","parent":-1},"a344d":{"name":"Accent Transparent","parent":"cff50"}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"cff50":{"val":"var(--tcb-skin-color-0)"},"a344d":{"val":"rgba(46, 138, 229, 0.85)","hsl_parent_dependency":{"h":210,"l":0.54,"s":0.78}}},"gradients":[]},"original":{"colors":{"cff50":{"val":"rgb(0, 178, 255)","hsl":{"h":198,"s":1,"l":0.5}},"a344d":{"val":"rgba(0, 178, 255, 0.85)","hsl_parent_dependency":{"h":198,"s":1,"l":0.5}}},"gradients":[]}}]}__CONFIG_colors_palette__

Get In Touch

Iā€™m always looking for awesome input, feedback and critique!

>