RPG3

The old 1980's version of RPG Language

Welcome to my little corner of the Cloud

Hello, my name is Nick Litten and I'm a technology addict, nerd, geek and Propeller Head!

In case your wondering, I'm an IT Consultant with a technology addiction - show me anything from a smartphone to a touch-screen fridge and I immediately get all jittery. Playing with Drupal on this website is just one way for me to let off steam. Nick Litten Dot Com is a mixture of blog posts that can be serious, playful and down-right pointless all in the space of a day.

Enjoy your stay, feel free to comment and in the words of the most interesting man in the world: Stay thirsty my friend.

about me

Who is Nick Litten?

I'm an IT Consultant primarily working on IBM Power Systems (IBM i, System-i, iSeries, AS400).

I've worked with the IBM AS400 (iSeries, IBMi) for twenty years and specialize in all variants of the RPG/CL language as well as detailed knowledge of systems infrastructure, connectivity, change management, security, disaster recovery, database design and much more. During this time I have worked with many applications ranging from ERP systems like JBA (GEAC/INFOR) System/21 to Casino and LMS applications. I classify myself as an expert programmer in RPG and CL languages, and I strive to rapidly develop new software solutions and offer a best of class support system for existing computer systems and infrastructure.

Nicholas John LittenOutside of the '400' world I've been designing, managing and optimizing websites since the first days of the World Wide Web. I have extensive ecommerce experience and have built websites with most of the common CMS applications (Drupal, Joomla, DotNetNuke, etc). I manage several websites specifically focusing on SEO/SEM: Search Engine Optimization and Marketing.

This diversity gives me a special insight into building exceptional business relationships and providing solutions that reap increasing benefits for my clients.

I've worked for clients all over the world and my experience in the distributing and manufacturing fields, as well as my capacity to easily transfer my knowledge are significant.

  • I'm serious, professional, autonomous and responsible.
  • I quickly appraise and resolve problems.
  • I work well under pressure, especially when schedules are tight.

I'm in the enviable position where my work is my hobby and I spend as much time at the keyboard playing with cool digital stuff as I do actually developing and deploying it.

I am results oriented and confident that I will add value to your IT team.

For a detailed Resume please view my profile on LinkedIn 

View Nick Litten's profile on LinkedIn

Nick Litten
IBM i Developer & IT Solution Provider

Projex | Contact | Skype | Blog | LinkedIn | Twitter
Nick Litten's Facebook Profile

 


 

Brief Curriculum Vitae

I'm an experienced IT Consultant and e-Business Solution Provider specializing in services for the IBM Power i Systems [AS400], Web and Internet Technologies.

I'm an AS400 specialist, an RPG analyst programmer, Web designer and SEO/SEM consultant.

Career professional with a proven track record administering, developing and supporting IBM-i (AS400) applications and web based technologies. Experienced programmer, systems administrator, network and change management expert. Supported many IBM i (AS400) products as a senior level engineer. Broad web design, e-commerce, SEO and data interface experience.

Specialties
IBMi on Power Systems: iSeries, AS/400, DB2/uDB, IFS, Drupal, change management, security, encryption, communications and system administration. - i5/OS, RPG (Free, ILE, IV, and III), JAVA, PHP, DB2 SQL, JSP, HTML, XML, CSS, XSLT, MQ Series and more, Web2.0 methodologies, JBA System21 Applications, AS400/iSeries configuration, Security management, Change management, Network infrastructure, inter-system communications, data exchange.

Languages
RPG, CL, JAVA, XML, SQL, PHP, HTML, CSS

Change Management
Turnover, Aldon, Implementor400

Web based technologies
Drupal, Joomla, PHP, JAVA, HTML, XML, CSS

 

 

 

Recommendations For Nick Litten

Freelance IBM i Developer @ Software Projex

“Nick's commitment and dedication to providing the highest quality technical solutions is second to none. Working with him as he helped launch an after-market parts & accessories B2C project gave me the opportunity to see his ability to break complex tasks into manageable deliverables, to combine modern web technologies with a legacy AS/400 application - including print functionaltiy, and after-deployment system support. Users find him a pleasure to work with and continually go to him for support and to discuss both existing features and functionality as well as system enhancements that they would like to implement. Nick can be counted on to consistently deliver when others fall short while being a pleasure to work with.” Julie Kentner, IT Business Partner, E-Z-GO Textron, hired Nick in 2008

 

“Nick is a triple A rated i Series Consultant. Everytime I have recruited Nick for client projects he has delivered. But more than that, the feedback that I have had from clients has been that Nick always goes that bit further to bring value to the project in terms of ideas and team spirit. He is personable, very business minded and trustworthy. As a contract recruiter there is nothing I like more than to have clients raving about the contractors I recruit for them and clients have always done that with Nick.” Steve Brown, Summit Consulting UK, hired Nick as a IT Consultant in 1998, and hired Nick more than once

 

I have used Nick's services many times over the past five years. He has built excellent web-sites and supporting services for my business, is always personable and listens carefully to our issues before offering a solution(s). Nick has a highly tuned commercial acumen and broad technical experience. Most importantly he responds quickly in a crisis and if he does not have the answer he will go and find it. I have recommended Nick to several friends and business colleagues who are all very happy with his service, attitude and charges. He is very professional and a thoroughly good bloke.” Adrian Sewell, Questix, hired Nick as a IT Consultant in 2002, and hired Nick more than once

 

Nick has a great combination of expert knowledge and clear communication skills. He single-handedly built and installed our office systems with none of the problems which had plagued us with our previous IT supplier. Most import, his onsite training was clear, concise and his knowledge of everything from PC components to internet design is second to none.” Peter Frithe hired Nick as a IT Consultant in 2008, and hired Nick more than once

 

 

 

Nick is an exceptionally talented IT professional with particular expertise in the field of IBM i, iSeries, AS/400 development and technical management. I worked with Nick for several years in a specialist team tasked with turning around legacy AS/400 systems that had seriously lacked investment and management. Nick's ability to take such challenges on board resulted in a modernised, audit approved, and well managed environment with minimal impact to the business. There are few that I would personally rate as experts and Nick is one of them.” Ian King, Vice President, Dresdner Kleinwort worked directly with Nick at Dresdner Kleinwort

 

Nick worked on my team acting as technical guru across the iSeries platform, upgrading old RPG3 code to state of the art RPG/ILE and directing the team towards better technical use of the machine allowing improved application performance and system integration He is an excellent worker always looking for superior solutions, a very affable individual and I have no hesitation in recommending Nick from both a technical and personal perspective.” Colin Sandler, Vice President - IT, Dresdner Kleinwort Wasserstein worked directly with Nick at Dresdner Kleinwort

 

Please feel free to email Nick Litten if you have any questions or comments about the the website, IBM Power i systems, AS400, RPG, ILE, CLP or anything else to do with life in general.

 

 

It's easy to upgrade AS400 RPG/400 to modern, web-enabled IBM i RPG4... honest!

RPG Modernization made simple

or a tale of taking old crusty gray haired legacy RPG and making it modern rich and vibrant -- or is that over playing it too much? ;)

The more I play with Profound/UI the more I like it...

(virtually) unchanged RPG code, auto-generated DDS for HTML version of DSPF and a recompile and *boom* web enabled RPG applications... Especially cool, because going forward if we need to make a change to the RPG program then its as simple as making the change to the one version of the code and then (1) compiling it over the old DDS/DSPF into the 'green screen' library and then (2) compiling the same RPG source code over the new Profound RichDDS/DSPF into the web library and *KABOOM* -- two versions of the program, one running perfectly in green screen and one running perfectly in the web, but both including our new code changes.

Like it!

Latest version of RPG is RPG7.1 right?

 

RPG is not a Rocket Propelled Grenade

RPG2 is that Logic Cycle Thing

RPG3 is the System/38 version

RPG400 is the revamped RPG3 that came with AS400

​everything after that is RPG... unless its ILE then its RPGLE or sometimes RPG4, or its free format so its RPGLE /Free... or its SQL so its RPGSQL or SQLRPGLE... or as many people call RPG/Free - RPG FIVE..... aaaargh

Why doesn't IBM just have a simple version number for each iteration of the wonderful IBM RPG programming language?

IBM i 7.1 Technology Release 7


I love the enhancements to RPG with IBM i V7.1.7. RPG finally looks and reads like a normal modern language. With the advent of this latest version of IBM i, RPG has been neatly upgraded to be a fully free format language. This is a long overdue and a significant change to the language itself. 

IBM RPG sub-procedures are very saucy indeed

This morning I got question from an old RPG3 chum of mine:

I know a couple of questions they will ask me, what are the different parms used on sub-procedures like *OMIT/*Nopass. Didn't we use those any way? I thought we were writing programs that did or did not necessarily get parms depending what called them using those keywords? To be honest, I know I can look it up but what the bloody hell is a sub-procedure?

My answer started off little then got into the huge waffling email stage. Bear in mind this is a very high level overview and not designed to get into the nitty-gritty of anything. Anyway, I just decided to copy/paste it here for future reference.

 


 

*OMIT/*NOPASS makes parameters funky

*OMIT - Lets you send a parameter as a value or as *nulls

Lets you use the *OMIT keyword when calling you program. So, if you just dont want to pass anything, you can say *OMIT - I think it just passes *NULLS and in the program that is being called you would say something like 

if %addr( parm1 ) = *NULL ;
  parmvalueinprogram = 'something';
else ;
  parmvalueinprogram = 'parm1';
endif ;

 

Gunnar RPG Computer Glasses

Gunnar glasses for RPG Programmers

My first memories of wearing glasses were from my pre-teens; my Mum taking me down the local opticians to collect my big brown plastic NHS specs. Some seriously horrible, big brown plastic things. This led to years of school ground taunting being called a speccy-four-eyes and finally refusing to wear them and spending years squinting at blackboards or copying off people next to me… then into my late teens and invention of personal computers and my inevitable attraction to keyboards and monitors… my eyesight took a turn for the worse. By the time I was thirty, I was properly shortsighted (-5 in both eyes) and glasses and/or contacts were just a part of life.

I wish Gunnar optics were around in those days.

I’ve been thinking about wearing glasses specifically for computer work recently, and just today I realized that Gunnar have some glasses called the GUNNAR RPG. So, obviously, as an RPG Programmer they are designed for me!

left adjust alpha into numeric using RPG language

So, I was writing a little code snippet for a client after being told that all warehouse codes must be treated as 3 numeric character integers ranging from 1-999 and soon saw that the warehouse value was an alphabetic field? Huh? A little more digging around and I soon found a problem in their database design: They have a database storing warehouse codes, but in some tables they are stored as two character alphameric values, sometimes as three character alpha's and other times as 3 character numerics! :/

Now, if that doesnt set off all kinds of alarm bells in your brain, then you probably want to stop reading and go and make a nice cup of tea and watch a reality show on the Discovery channel. But, if you are a techie and just scratched you head and thought "WTF? Who designed that database then?" the simple answer is NOT ME. Obviously, it was designed by a maniac. Sadly, I'm the programmer who has to work with it and it's established in the business so us poor programmers just have to figure out how to best work with it.

Anyway, before I spend too much time moaning about lazy programmers and their crappy database design, this is how I got around it.

RPG Debug display large field content

How to view big fat fields using the RPG Debugger

In my on-going mission to to prove that you can teach an old dog new tricks… I learned a neat one today. I was trying to debug an IBMi Web Interface program (IBM RPG/FreeFormat Language) that was blowing the 64k field size limit when reading in an XML string containing hundreds of order lines.

"Yes, I know the upgrading to IBMi 6.1+ will solve the problem and increase the field limit to 16MEG (Yum!) but the client is on v5r4 and I’m stuck with that….”

So, after a little XML cleanup routine I go the field size down below the 64k limit but still had a problem with XML validation. More scratching of head and after running around in debug I discovered that my XML-RPG validation routine didn’t like something at character position 34,381 in the string. Of course, when in debug and you look at a variable it only shows you the first 1000 character of any fields data:

 

EVAL gReqData                                                         

GREQDATA =                                                            

          ....5...10...15...20...25...30...35...40...45...50...55...60

Update WebSphere Development Studio Client to Version 7.0.0.8

So, you've installed WDSC7 now what?

 

1 - Automatically update to WebSphere Development Studio Client, Version 7.0.0.8:

Install the fix pack with the same user account that installed the product.

Restrictions:

  • WebSphere Development Studio Client for iSeries, Version 7.0, 7.0.0.1, 7.0.0.2, 7.0.0.4, or 7.0.0.6 must be installed.
  • The product cannot be open when you install this fix pack.

To find and install WebSphere Development Studio Client, Version 7.0.0.8 as an update:

Download and Update WebSphere Development Studio Client WDSC7 for free

I'm an IBMi Developer - do I choose SEU, RSE or WDSC?

If your caught between using SEU (Stoneage Editting Utility) and RSE (Really Stupidly Expensive) for your IBM-i code development environment - you have one other glaringly obvious choice - WDSC (Wonderful Double Super Codetool).

Personally, I like WDSC because its $FREE and I'm cheap :)

This was the last iteration of the Websphere Development suite before IBM, rebuilt and rebranded it as the 'Rational Developer Tool' and decided to charge $900 per copy. For Freelance RPG Programmers like me that just puts the tool completely out of my budget. how could IBM possibly justify $900 for a single code editor application that was previous free. Compare this to Microsoft MSDN charges where I gladly pay $300 for a license for every single piece of Microsoft Software out there! That is a big thumbs up for MSDN subscriptions and a big raspberry for IBM's RDi/p costs.

using %REPLACE to Scan Replace in RPG4

replace my head with a younger more handsoe one please

So, I want to do a SCAN and REPLACE in RPG - What's the easiest way?

Using the %REPLACE built in Function is easy and efficient allthough code wise its a little cumbersome:

// Update email address                                  
Dow %Scan('L#EMAIL': %TRIMR(SrcDta )) > *Zeros;          
    SrcDta  = %Replace(%trimr(ParmEmail) 
              :SrcDta 
              :%Scan('L#EMAIL' : %TRIMR(SrcDta ))
              :7);    
EndDo;                                                   

In this example, I am scanning a program variable (SRCDTA) looking for any occurence  of the word "L#EMAIL" and replacing it with the contents of "PARMEMAIL". The email value is %TRIM'ed which means that any blanks at the end of the email address are ignored.

I use a similar process in the PROJEX Service Program and then you can easily run a SCAN/REPLACE on a single line of RPG code.

So lets say I wanted to scan for the word 'bob' and change it for the word 'Fred' within a string i could do it like this using this Prototype:

$ResultVariable = #Scanreplace ( $OriginalVariable : 'bob' : 'Fred' )

Much simpler than using the complex %REPLACE BIF I'm sure you will agree. 

Here's the Prototype:

How do I right adjust a numeric into an alpha field using RPG4?

I have a NUMERIC in an RPG program that I want to move RIGHT into an Alpha field. In the old days of RPG3 I would use MOVE but in the new days of RPG4 I have a couple of more flexible solutions.  So, lets say we have a numeric field containing the number 1234, defined as an signed numeric 10 long it would be stored as - 0000000123. And a Result field which is a big long alpha field:

d $Numeric          s             10s 0 inz(1234)

d $Result           s             10a   inz(*BLANKS)

Some programmers will forget that $variable = $something else is actually eval $variable = $something because the eval is silent  :)
 
We have two easy ways of transforming using RPG4:

With Zero Suppression

If we want to be  tranformed right justified  as  '          1234'' then:

Eval(r) ResultVariable = %char($Numeric);

Note that the %CHAR %BIF will zero suppress the front of any numeric value.

Without Zero Suppression

Doing Loop the Loops in RPG3 and RPG /Free

So, whenever possible, if I'm editing some old RPG3 or RPG400 code I spend a coffee* cleaning the code up to a more readable form:

  • Use CVTRPGSRC if its old RPG3 stuff
  • Change '1' to *ON
  • Change '0' to *OFF
  • Change Z-ADD to EVAL
  • Insert comments where applicable
  • put some spaces between subroutines and blocks of functionally similar code
  • Then its into WDSC7 and convert to /FREE

Websphere is old technology but I'm not going to spend over $800 on IBM's Rational Developer for i version... c'mon IBM come up with a sensible price for a source code editor. Obviously, the most sensible is FREE.

DO LOOPS are something that sometimes make me scratch my head when uplifting to RPG4. So just for my reference here is an example of the exact same code in RPG3, RPG400 and RPG4 (or RPG ILE as its sometimes called).

 

RPG3

             DO        SAVRRN        X
             MOVE      PLOP          THING
X            IFGT      10
FIELD1       CAT       FIELD2        RESULT      
             END
             END

 

RPG400

Convert RPG %DATE into a signed numeric

To convert a DATEFIELD to this 8s0 field with no ‘/’ or ‘-‘ do this:

 

 

D  USADate                    8s 0

USADate = %dec(%char(DateField:*iso0):8:0);

 

Or another even neater function is this:

 

USADate = %uns(%char(DateField:*USA0));

 

I prefer this %UNS built in function, since it does not require me to specify length and decimal position parameters. 

 

What is %UNS?


%UNSH (Convert to Unsigned Format with Half Adjust)

 

%UNSH(numeric expression)

%UNSH is like %UNS except that if the numeric expression is a decimal or a float value, half adjust is applied to the value of the numeric expression when converting to unsigned type. No message is issued if half adjust cannot be performed.

 

*..1....+....2....+....3....+....4....+....5....+....6....+....7...+....

add days to 100 Year date from EXCEL using RPG

vintage computing

So, we had a file coming in from an external partner today – containing a date in Julian Format. Or what I initially thought to be Julian format. 

[quote=Some Website Out There]Many applications (especially mainframe systems) store dates in the Julian format, which is a 5 digit number, consisting of a 2 digit year and a 3 digit day-of-year number.   For example, 24-August-1999 is stored as 99236, since 24-August is the 236th day of the year...[/quote]

Then when I looked at the date in question I realised the value was 42345 but this was representing an actual date of December 8th 2015! So, this clearly isnt a Julian date... Hmmm...

Cutting to the chase, it turns out that this date is stored in what the customer refers to as '100 year date format' which is basically the number of days since the last day of 1899. Which just goes to show that those crazy Victorian's where utter whackjobs. 

Luckily its simple to figure out programmatically using RPG4:

 

free rpg code editor for windows - Visual RPG Express

free rpg3 and rpg4 code editor

I'm a big fan of WDSC7 (Websphere Development Studio Client for Windows) for my RPG/CL/DDS/SQL/whatever coding when I'm using windows.. but there are a few others out there. I would love to use IBM's RDi (Rational Developer for IBM i) but while IBM insist on charging around $900 for the program it puts it firmly out of my wallet range. Quite frankly, its such an utterly ridiculous price for a piece of software I cant ever see myself championing it.

I found this article over at Midrange News:

[quote]Visual RPG (aka "CodeStudio") is a PC Windows XP-based editor for RPG IV, DDS, and other languages. It was original sold to AS/400 developers as a "CODE/400 for Windows" product when there was no Windows-based "CODE/400" (they only did an OS/2 version). Later it was renamed to "CodeStudio" and that trademark was purchased by a multi-national corporation and the product name was changed back to its original "VisualRPG" and provided at no-charge with no support. It uses FTP to pull down the source from the host and save it back up to the host, hence the source statement change dates are lost.[/quote]

Here are the instructions (over a decade old but if they help someone out then TADA!)

RPG4 is not a new Rocket Propelled Grenade

learning rpg programming language

I occasionally get an email from RPG programmers out there in IBMi-Land who have spent the last decade gently plodding along in RPG3 and RPG400 and now face the daunting prospect of having to hone there RPG skills and learn RPG4 (or RPG-LE or /FREE as its also called). So, I’ve quickly cobbled together links and information from various sources on the web and dropped it here for reference.

What Software Tool do I use to write RPG?

Three main choices really:

Exit Programs, Audit Trails and APIs

Question: All the Exit Program examples I see are in the C Language. Is it possible to write Exit Programs in RPG?

Answer: Yes, but you must write a data structure as same as it in the C header file. The C header file is H/QSYSINC. This include is also available for other languages in QSYSINC/QRPGSRC, QSYSINC/QRPGLESRC, QSYSINC/QLBLSRC, and QSYSINC/QCBLLESRC.

Question: I have been asked to find out how AS/400 users can change their passwords using a web browser application.  We will synch user info to the NT Domain server to enable validation and signon.  The AS/400 passwords expire every 30 days.  The users must be able to maintain their passwords without leaving the web application (a combination of Cold Fusion, Javascript and HTML).  Off the shelf packages are OK, or IBM supplied API that support some sort of encryption (we don't want passwords xmitted over the internet in the clear.)  Any and all suggestions are appreciated. (12/99)

Answer 1:  If Java is an option then you can use the Java ToolKit for AS/400.  The code used to exchange and/or change passwords is encrypted out the wazoo before it is sent over the net. Unless you are going to use some sort of strong encryption for sending the password from the browser (implemented in an applet) to the http server I would suggest supporting SSL on the www server.

as400 users become iseries users become IBMi users

rpg code example seu pdm

User profiles are such a wonderful and flexible part of the IBMi operating system. Group profiles, Security levels, authorization lists.... good stuff:

Managing User Profiles

Question I am having a problem with user profiles disabling randomly.

Answer 1. It sounds like someone has used the Security Toolkit to activate the "automatically disable inactive profiles" option. That's not really it's name. It's name is "Analyze Profile Activity" on the menu option, which sounds benign enough, but in fact it will initiate this scheduled auto-disable.

From the Security Toolkit (GO SECTOOLS) choose option 4 (ANZPRFACT) and set the number of days to *NOMAX. This will prevent any profile from being automatically disabled by this new feature.

Alternately, you could leave the auto-disable at 90 days, and then use options 2 & 3 on that same menu to exclude certain profiles from being disabled.

Pages